diff --git a/src/index.ts b/src/index.ts index 2df4731..9d73368 100644 --- a/src/index.ts +++ b/src/index.ts @@ -71,32 +71,6 @@ export class GenerateXLSXFile { return fetch(`./xlsx-templates/${this.templateName}`).then((r: Response) => r.blob()); } - // public exportXLSX(): void { - // console.log('exportXLSX view model:: this.viewModel'); - // this.onRetrieveTemplate() - // .then((xlsxBlob: Blob) => { - // const reader: FileReader = new FileReader(); - // reader.readAsArrayBuffer(xlsxBlob); - // reader.addEventListener('loadend', async (e: ProgressEvent) => { - // const renderer: Renderer = new Renderer(); - - // if (reader.result instanceof ArrayBuffer) { - // const workbook: Excel.Workbook = new Excel.Workbook(); - // await workbook.xlsx.load(reader.result); - // const result: Excel.Workbook = await renderer.render(() => Promise.resolve(workbook), this.viewModel); - - // await result.xlsx - // .writeBuffer() - // .then((buffer: Excel.Buffer) => { - // this.saveBlobToFile(new Blob([buffer]), `${Date.now()}_result_report.xlsx`); - // }) - // .catch((err: Error) => console.log('Error writing excel export', err)); - // } - // }); - // }) - // .catch((err: Error) => console.log('Error:', err)); - // } - public async exportXLSX(): Promise { console.log('exportXLSX view model:: this.viewModel'); try { @@ -117,29 +91,6 @@ export class GenerateXLSXFile { } catch (err) { console.log('Error:', err); } - - // this.onRetrieveTemplate() - // .then((xlsxBlob: Blob) => { - // const reader: FileReader = new FileReader(); - // reader.readAsArrayBuffer(xlsxBlob); - // reader.addEventListener('loadend', async (e: ProgressEvent) => { - // const renderer: Renderer = new Renderer(); - - // if (reader.result instanceof ArrayBuffer) { - // const workbook: Excel.Workbook = new Excel.Workbook(); - // await workbook.xlsx.load(reader.result); - // const result: Excel.Workbook = await renderer.render(() => Promise.resolve(workbook), this.viewModel); - - // await result.xlsx - // .writeBuffer() - // .then((buffer: Excel.Buffer) => { - // this.saveBlobToFile(new Blob([buffer]), `${Date.now()}_result_report.xlsx`); - // }) - // .catch((err: Error) => console.log('Error writing excel export', err)); - // } - // }); - // }) - // .catch((err: Error) => console.log('Error:', err)); } // Utilities - File Save