diff --git a/js/buttons.html5.js b/js/buttons.html5.js index ae008c7..26bacdf 100644 --- a/js/buttons.html5.js +++ b/js/buttons.html5.js @@ -1385,6 +1385,12 @@ DataTable.ext.buttons.excelHtml5 = { filename = filename.substr(0, 175); } + // Let the developer customize the final zip file if they want to before it is generated and sent to the browser + if (config.customizeZip) { + config.customizeZip(zip, data, filename); + } + + if (zip.generateAsync) { // JSZip 3+ zip.generateAsync(zipConfig).then(function (blob) { diff --git a/js/dataTables.buttons.js b/js/dataTables.buttons.js index c5fe655..b31508c 100644 --- a/js/dataTables.buttons.js +++ b/js/dataTables.buttons.js @@ -2564,7 +2564,8 @@ var _exportData = function (dt, inOpts) { return Buttons.stripData(d, config); } }, - customizeData: null + customizeData: null, + customizeZip: null }, inOpts ); diff --git a/types/types.d.ts b/types/types.d.ts index 94b6e5e..4536187 100644 --- a/types/types.d.ts +++ b/types/types.d.ts @@ -555,6 +555,11 @@ declare module 'datatables.net' { */ customizeData?: FunctionButtonCustomizeData; + /** + * EXCEL + */ + customizeZip?: FunctionButtonCustomizeZip; + /** * PDF: portrait / landscape */ @@ -629,4 +634,6 @@ declare module 'datatables.net' { type FunctionButtonCustomizeData = (content: any) => void; type FunctionButtonColvisColumnText = (dt: Api, i: number, title: string) => string; + + type FunctionButtonCustomizeZip = (zip: any, data: ButtonsApiExportDataReturn, filename: string) => void; }