how to use SheetJS (js-xlsx) in angular 2

后端 未结 6 1863
旧巷少年郎
旧巷少年郎 2020-12-29 16:29

I\'m learning angular2 and i wanted to use js-xlsx library in my project.

I installed xlsx npm install xlsx and jszip npm install jszip an

6条回答
  •  失恋的感觉
    2020-12-29 16:39

    tryout ts-xlsx, it's simple to use
    npm install --save ts-xlsx
    then install the typings
    npm install --save @types/xlsx

    /* You can use as namespace: */
    import * as XLSX from 'ts-xlsx';
    let wb: XLSX.IWorkBook = XLSX.read(...)
    
    /* Or straight forward import */
    import { read, IWorkBook } from 'ts-xlsx';
    let wb: IWorkBook = read(...)
    

提交回复
热议问题