Angular 5 app breaks when using XLSX to export table to .xlsx file in prod build.
See original GitHub issueI’m trying to use xlsx package for exporting files from table to .xlsx file. It works on normal build but breaks on prod build in Angular 5.
let sheetName;
var tbl = document.getElementById(this.activeTab);
/* generate worksheet */
let ws: XLSX.WorkSheet = XLSX.utils.table_to_sheet(tbl, {raw:true});
ws['!cols'] = [
{wpx: 200}, // "characters"
{wpx: 200}, // "pixels"
{wpx: 200},
{hidden: true} // hide column
];
/* generate workbook and add the worksheet */
const wb: XLSX.WorkBook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, sheetName);
/* save to file */
XLSX.writeFile(wb, this.fileName, {type: "base64"});`
Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Angular 13 Export HTML5 Table to Excel (.XLSX) File and ...
XLSX ) File and Download it Using xlsx Library in TypeScript ... [ Building a Playlist Search App using Youtube Data Api v3] ......
Read more >Export to Excel on Angular 5 - typescript
If you have an array you can use json_to_sheet() : import {writeFileXLSX, utils} from 'xlsx'; ///... exportToExcel(): void { const data ...
Read more >xlsx
Most scenarios involving spreadsheets and data can be broken into 5 parts: Acquire Data: Data may be stored anywhere: local or remote files, ......
Read more >How to Import and Export Excel XLSX Using Angular
Learn how to import and export Excel XLSX files using Angular. See more from SpreadJS today.
Read more >Save a workbook to text format (.txt or .csv)
Sometimes, you might need to save a workbook in another file format, like a text (txt) or a comma-separated values format (csv). Just...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What is the error message? Can you share a sample project?
Since this works with the standard new ng project setups, we can only assume the issue lies with how Angular or your specific projects work with the library in prod mode. This is unfortunately the type of issue that would require someone well-versed in Angular to diagnose.