GrapeCity.Documents.Excel.Workbook fails to open new excel file versions

Posted by: alistair on 20 June 2024, 12:55 am EST

    • Post Options:
    • Link

    Posted 20 June 2024, 12:55 am EST

    Running test code with the GC excel components - they fail to open newer versions of excel docs.

    The exception received is:

     OpenTest
       Duration: 149 ms
    
      Message: 
        Test method XlsxTest.OpenTest threw exception: 
        GrapeCity.Documents.Excel.alw: Unexpected character encountered while parsing value: P. Path '', line 0, position 0.
    
      Stack Trace: 
        amc.ac()
        amc.yx()
        xj.ag(buo a, amc b, Dictionary`2 c, List`1 d, Dictionary`2 e, List`1 f, List`1 g, List`1 h, List`1 i, List`1 j, Dictionary`2 k, Dictionary`2 l, Int32& m, we n, IList`1 o)
        xj.ad(buo a, Stream b, IList`1 c)
        Workbook.FromJson(Stream stream, DeserializationOptions deserializationOptions)
        Workbook.am(String a, DeserializationOptions b)
        Workbook.Open(String fileName, DeserializationOptions deserializationOptions)

    The code used for the test:

          string filename = @"C:\temp\pristine.xlsx";
    
          string key = "YOUR KEY HERE";
    
          var sourceWorkbook = new Workbook(key);
          sourceWorkbook.Open(filename, new DeserializationOptions
          {
            IgnoreStyle = true,
            DoNotRecalculateAfterLoad = true,
          });

    I attach a default excel file with no changes in it that should allow you to replicate the test.

    We have this working with older more complicated excel files that were made with older versions of excel.

    The version of GC I’m using is 7.1.3 on a .NET Core 7.0 project

  • Posted 20 June 2024, 1:00 am EST

    Attachment didn’t attach for some reason

    pristine.zip

  • Posted 21 June 2024, 2:24 am EST

    Hello,

    The DeserializationOptions class that you are using is used when importing workbook from JSON.

    As you are using the XLSX file so you should use the XlsxOpenOptions at you end. Please find following link for the same:

    https://developer.mescius.com/document-solutions/dot-net-excel-api/docs/online/open_and_save_workbook.html?highlight=open%2C#a

    If you still face any issue, please let us know.

    Regards,

    Prabhat Sharma.

  • Posted 21 June 2024, 2:54 am EST

    Thanks

Need extra support?

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

Learn More

Forum Channels