exceljs icon indicating copy to clipboard operation
exceljs copied to clipboard

Cannot use streaming with angular8,

Open Congyi-Shi opened this issue 5 years ago • 4 comments

When I use angular8 , I have test "import * as Excel from 'exceljs/dist/exceljs.min.js';" and get response sviz.error.handler.ts:68 TypeError: Cannot read property 'xlsx' of undefined; I tried to use "import Excel from 'exceljs/modern.browser';" with errors : ERROR in ./node_modules/exceljs/dist/es5/csv/csv.js Module not found: Error: Can't resolve 'fs' in 'C:\Users\P092785\SVIZ\sviz-stack\app\sviz\node_modules\exceljs\dist\es5\csv' ... failed to compile

Anybody can help me?

Congyi-Shi avatar Aug 07 '19 15:08 Congyi-Shi

fs is a filesystem module which is available for the node version. What happens if you don't target a specific file? Like this:

import Excel from 'exceljs';

A1rPun avatar Aug 08 '19 15:08 A1rPun

fs is a filesystem module which is available for the node version. What happens if you don't target a specific file? Like this:

import Excel from 'exceljs';

Thank you for the response,after i remove the specific file, the application runs, but when i try to use the function Excel.stream.xlsx.WorkbookWriter, there are some errors: TypeError: Cannot read property 'xlsx' of undefined

Congyi-Shi avatar Aug 12 '19 08:08 Congyi-Shi

fs is a filesystem module which is available for the node version. What happens if you don't target a specific file? Like this:

import Excel from 'exceljs';

Thank again, maybe i found where the problem comes, exceljs does not support the streaming workbook writer within a brower environement....

Congyi-Shi avatar Aug 12 '19 10:08 Congyi-Shi

Browser

A portion of this library has been isolated and tested for use within a browser environment.

Due to the streaming nature of the workbook reader and workbook writer, these have not been included. Only the document based workbook may be used (see Create a Workbook for details).

For example code using ExcelJS in the browser take a look at the spec/browser folder in the github repo.

😂I'm confused, too. But now I've found this description

XuJaven avatar May 27 '22 02:05 XuJaven