Error During export to Excel 'h is not a constructor'

Posted by: sameer.boddun on 10 October 2017, 8:11 pm EST

    • Post Options:
    • Link

    Posted 10 October 2017, 8:11 pm EST

    Hello,

    I am getting Below error when I am trying to export the grid (treeview) to excel.

    ERROR TypeError: h is not a constructor     at Function.n._saveWorkbookToZip (wijmo.xlsx.js:13)     at Function.n.save (wijmo.xlsx.js:13)     at n.save (wijmo.xlsx.js:13)     at Function.n.save (wijmo.grid.xlsx.js:13)     at ProjectComponent.webpackJsonp.163.ProjectComponent.exportExcel (project.component.ts:202)     at Object.eval [as handleEvent] (ProjectComponent.html:7)     at handleEvent (core.es5.js:11997)     at callWithDebugContext (core.es5.js:13458)     at Object.debugHandleEvent [as handleEvent] (core.es5.js:13046)     at dispatchEvent (core.es5.js:8601)

    I have following html code

    <div class="text-right">       <button type="button" class="btn btn-primary" (click)="exportExcel()"> Export </button>     </div>

    and my component class has following code

        exportExcel() {         wjcGridXlsx.FlexGridXlsxConverter.save(                 this.flex,                 { includeColumnHeaders: this.exportIncludeColumnHeader, includeCellStyles: false },                 'ProjectSummary.xlsx'         );     }

    This code is as per the code example provided in wijmo explorer

    Thanks

    Sameer.

  • Posted 11 October 2017, 9:09 pm EST

    Hi Sameer,

    Please be sure if you have added JSZip file in your project. If the issue persists, please share a sample depicting your issue.

    ~Manish

  • Posted 12 October 2017, 6:23 pm EST

    Hi Manish,

    I have added , following dependecies in my package.json

    "jszip": "3.1.3"
    

    I am attaching a sample project which has same code that I am using and having a same issue. Please examin it and let me know if I am missing anything.

    thanks

    Sameer.FlexGrid_treeView_ComboBox.zip

  • Posted 23 October 2017, 5:21 pm EST

    Hi Manish -

    Do you have any update on this issue ?

    Thanks

    Sameer.

  • Posted 24 October 2017, 8:48 pm EST

    Hi Sameer,

    We are sorry for the late reply.

    You need to include module in main.ts or you can simply add JSZip CDN reference in index.html.

    Please refer to the attached sample for including JSZip as a module.

    Alos, please use 2.5.0 if you are using save method and 3.0.0 if using saveAsync.

    ~Manish

    FlexGrid_export_JSZIP_as_module.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels