Cannot instance GC.Spread.Excel.IO

Posted by: leif on 22 May 2020, 3:26 am EST

  • Posted 22 May 2020, 3:26 am EST

    I am currently evaluating the SpreadJS libraries.
    Following several tutorials and samples i must admit that i just cannot create an instance of GC.Spread.Excel.IO. Am i doing something wrong? Or is ExcelIO not free for evaluation?

             

    In head:
    <link href="node_modules/@grapecity/spread-sheets/styles/gc.spread.sheets.excel2013white.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="node_modules/@grapecity/spread-sheets/dist/gc.spread.sheets.all.min.js"></script>
    <script type="text/javascript" src="node_modules/@grapecity/spread-excelio/dist/gc.spread.excelio.min.js"></script>



    In window.onload handler:

    // simply works
    var workbook = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));

    // cannot get this to run
    var excelIO = new GC.Excel.IO();
  • Replied 22 May 2020, 3:29 am EST

    var excelIO = new GC.Spread.Excel.IO();

    does not work either:

    Cannot read property 'IO' of undefined
  • Replied 26 May 2020, 1:31 am EST

    Hi Leif,

    Using new GC.Spread.Excel.IO(); to instantiate and use excelio is the correct way. Also you have added the proper references so there shouldn't be any issues.
    Could you share a sample replicating the issue so that we could further investigate itit? We tried to create one but were unable to replicate the issue, following is the sample we used:
    https://codesandbox.io/s/spread-js-starter-dinkj?file=/src/index.js

    Regards
    Sharad
  • Replied 26 May 2020, 1:49 am EST

    Hello Sharad,

    thanks for the working example. I got my code running re-typing it from scratch. I could not find any problem, though. So probably it was a hidden typo... or maybe the import order does matter... or...?
    Anyways: works now.
  • Replied 26 May 2020, 4:01 pm EST

    We are glad that the issue is resolved now.
    Yes, the import order does matter but in the code snippet you shared, the files were already referenced in the correct order i.e first the gc.spread.sheets.all.min.js file and then gc.spread.excelio.min.js file so the file order isn't the issue here, as you mentioned most probable cause could be hidden typo.
Need extra support?

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

Learn More

Forum Channels