Skip to content

Commit

Permalink
Updated TS code
Browse files Browse the repository at this point in the history
  • Loading branch information
jacekkoziol committed Jan 13, 2021
1 parent b15678f commit 003a150
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<FileReader>) => {
// 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<void> {
console.log('exportXLSX view model:: this.viewModel');
try {
Expand All @@ -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<FileReader>) => {
// 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
Expand Down

0 comments on commit 003a150

Please sign in to comment.