Excel.IO() 'Evaluation Version' of undefined

Posted by: davide.vago on 6 January 2020, 8:05 am EST

    • Post Options:
    • Link

    Posted 6 January 2020, 8:05 am EST

    Good morning/afternoon.

    I’m following this documentation https://www.grapecity.com/spreadjs/docs/v13/online/SpreadJS~GC.Spread.Excel.IO~save.html in order to extract a spreadsheet instance into an xlsx file but I’m getting the error: Cannot read property ‘Evaluation Version’ of undefined as soon as the script runs the function excelIO.save(…

    I’m using the latest 13.0.3 packages from npm

    and importing them as follow:

    import GC from '@grapecity/spread-sheets'
    import * as Excel from '@grapecity/spread-excelio'
    

    and running as follow:

    
    const excelIO = new Excel.IO()
          const fileName = 'sample.xlsx'
          const json = JSON.stringify(this.activeSheet.toJSON())
    
          excelIO.save(
            json,
            blob => {
              console.log('blob', blob)
              saveAs(blob, fileName)
            },
            e => {
              console.log(e)
            },
          )
    
    

    Logging the json constant and the excelIO returns me respectively the correct data in json format and a compressed object which contains:

    q: e {loadType: 1, fileReader: FileReader, passwordFileReader: FileReader, compoundFile: o}

    Note: (the import * as Excel) was suggested within the forum by the Grapecity support team.

    Note 2: saveAs function is not defined therefore I need to disable my linter in order to silence the error, might it be something missing from the documentation?

  • Posted 7 January 2020, 3:35 am EST

    Hi Davide,

    From the shaped code snippet it seems that you are trying to export the worksheet object instead of the workbook object. Please make sure that this.activeSheet refer to the SJS workbook instance.

    Note 2: saveAs function is not defined therefore I need to disable my linter in order to silence the error, might it be something missing from the documentation?

    saveAs utility is not provided by SpreadJS, you may add it in your project using the file-saver package.

    import { saveAs } from “file-saver”;

    Regards

    Sharad

Need extra support?

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

Learn More

Forum Channels