wijmo.xlsx & JSZip with Angular 4

781 Views Asked by At

I am having troubles using wijmo.xlsx and JSZip on Angular 4 for my Wijmo project. wijmo.xlsx requires JSZip as a dependency.

When I import JSZip in a TypeScript file as below it displays error an for JSZip.

import * as JSZip from 'jszip';

I installed JSZip using npm install jszip --save but it did not work.

I installed @types/jszip this time and error is gone. But when I am trying to use JSZip it is showing following errors:

(index):55 (SystemJS) window.require is not a function
TypeError: window.require is not a function at Object.eval 
(http://localhost:5555/node_modules/wijmo/wijmo.xlsx.js:13:871)
at eval (http://localhost:5555/node_modules/wijmo/wijmo.xlsx.js:14:4)
at eval (http://localhost:5555/node_modules/wijmo/wijmo.xlsx.js:15:3)
at eval (<anonymous>)
at Object.eval 
(http://localhost:5555/node_modules/wijmo/wijmo.grid.xlsx.js:13:694) at eval 
(http://localhost:5555/node_modules/wijmo/wijmo.grid.xlsx.js:14:4) at eval 
(http://localhost:5555/node_modules/wijmo/wijmo.grid.xlsx.js:15:3) at eval 
(<anonymous>)

What is the correct procedure to install JSZip and use it with Angular 4? Do we need to install @types/jszip first and then JSZip?

1

There are 1 best solutions below

0
On

If you need to add it as a module then see this link

https://www.grapecity.com/en/forums/wijmo/excelimportexport-in-angul

If you need to add it as a file then see this link