Export as Excel Error

Posted by: shiruiwei on 14 September 2017, 7:13 pm EST

    • Post Options:
    • Link

    Posted 14 September 2017, 7:13 pm EST

    [activereports_archive]Hello,

    I have a issue when exporting report as xlsx file. Here is the error message I got.

    By the way, exporting as PDF and txt are all correct.

    You can test this by passing invalidChar to a report like below.

    [csharp]

    string invalidChar = Char.ConvertFromUtf32(5);

            datatable.Rows[0][0] = dt.Rows[0][0] + invalidChar;
            report.DataSource = datatable;
    

    [/csharp]

    [ArgumentException: ‘’, hexadecimal value 0x05, is an invalid character.]

    System.Xml.XmlUtf8RawTextWriter.InvalidXmlChar(Int32 ch, Byte* pDst, Boolean entitize) +2452074

    System.Xml.XmlUtf8RawTextWriter.WriteElementTextBlock(Char* pSrc, Char* pSrcEnd) +5501414

    System.Xml.XmlUtf8RawTextWriter.WriteString(String text) +62

    System.Xml.XmlWellFormedWriter.WriteString(String text) +95

    DocumentFormat.OpenXml.OpenXmlLeafTextElement.WriteContentTo(XmlWriter w) +45

    DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter) +232

    DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w) +98

    DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter) +232

    DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w) +98

    DocumentFormat.OpenXml.OpenXmlPartRootElement.WriteTo(XmlWriter xmlWriter) +298

    DocumentFormat.OpenXml.OpenXmlPartRootElement.SaveToPart(OpenXmlPart openXmlPart) +146

    DocumentFormat.OpenXml.OpenXmlPartRootElement.Save() +16

    DocumentFormat.OpenXml.Packaging.OpenXmlPackage.SavePartContents() +160

    DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose(Boolean disposing) +27

    DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose() +20

    #tLD.#GOw.Export(Workbook workbook, String path) +146

    GrapeCity.SpreadBuilder.Workbook.Save(String filePath) +39

    GrapeCity.ActiveReports.Export.Excel.Section.XlsExport.Export(SectionDocument document, String filePath, String pageRange) +79

    GrapeCity.ActiveReports.Export.Excel.Section.XlsExport.Export(SectionDocument document, String filePath) +15

    Thanks,

    Ruiwei[/activereports_archive]

  • Posted 14 September 2017, 7:13 pm EST

    [activereports_archive]Hello Ruiwei,

    There must be an issue with the value you are passing in the method in your report file as the code shared in the following msdn article works correctly for me in AR10 : 10.1.6726.0 in all the exports(Excel,PDF,TXT) :

    https://msdn.microsoft.com/en-us/library/system.char.convertfromutf32(v=vs.110).aspx

    Attached is my report file for reference.

    Please check the behavior with the latest AR10 build and share your observations :

    http://activereports.grapecity.com/Downloads/

    If the issue persists with the latest build as well then you are requested to share a test/dummy report file that replicates your issue or make the necessary changes to my report so that I could debug the issue at my end and assist you appropriately.

    Regards,

    Reema[/activereports_archive]

    2016/08/ExcelExportIssue.rpx

  • Posted 14 September 2017, 7:13 pm EST

    [activereports_archive]Hi Reema,

    Thanks for you quick reply!!!

    The value I am passing is “0x05”, I just updated the report file you provided. You can refer to it. Use it you can reproduce the issue I have.

    At first I found the following post, some body had the same issue in old version.

    http://arhelp.grapecity.com/groups/topic/active-report-xlsx-export-generating-exception/

    Regards,

    Ruiwei

    [/activereports_archive]

    2016/08/ExcelExportIssue1.rpx

  • Posted 14 September 2017, 7:13 pm EST

    [activereports_archive]Hello,

    As such we are still unable to replicate any errors or exceptions at our end when exporting the shared report file to Excel with AR10.1.6726.0. A box is being rendered on the report for the value 0x05 which gets exported to the Excel sheet. This is the behavior we observe.

    Testing the same value(0x05) in a simple WindowsApp generates no output in the Console Window.

    Can you please confirm the following so that I could proceed further :

    • Have u tried the case with AR10.1.6726.0 available at :

      http://activereports.grapecity.com/Downloads/
    • Please share your environmental details(OS + VS) on which the issue is replicable at your end.

      We tested the issue on Windows10 + VS2015.

    Regards,

    Reema[/activereports_archive]

  • Posted 14 September 2017, 7:13 pm EST

    [activereports_archive]Currently, we are using AR10.1.6726.0 for development, it did not help us to resolve this problem.

    Our development environment: Windows7 + VS2013

    Attached is our test project, please take it as reference to reproduce the exception.[/activereports_archive]

    2016/08/New_SectionReport_ExportMVC.zip

  • Posted 14 September 2017, 7:13 pm EST

    [activereports_archive]Hello,

    Thanks for sharing the sample.

    I could observe the behavior at my end as well. The issue related to exporting hexadecimal content to XLSX format. It is not reproducible with Xls95 or Xls97Plus formats. I have escalated the issue to the concerned team(211056) for further review on this and will get back to you as soon as I get any information from their side regarding the same.

    Regards,

    Reema

    [/activereports_archive]

  • Posted 14 September 2017, 7:13 pm EST

    [activereports_archive]Hello,

    Here is an update from the development team :

    This is an XML issue. Not all symbols are valid for XML. Xlsx is serialized through Open XML SDK and this is the reason that its possible to export the report to Xls formats(Xls95 or Xls97Plus) but not to Xlsx format.

    Hope that clarifies.

    Regards,

    Reema[/activereports_archive]

  • Posted 8 June 2020, 6:35 am EST

    Hey Team, Do you have any workaround for the same as i am also facing the same issue.

  • Posted 8 June 2020, 6:54 am EST

    I am getting this below error

    hexadecimal value 0x18, is an invalid character.

    Which character is causing this?

    Can i replace that character with other valid character in my report?

    Thanks in advanced.

  • Posted 9 June 2020, 1:20 am EST

    Hello,

    You can export the excel into “XLS” instead of “XLSX”. It is design behavior as of now.

    You can go through the following link, it will helpful for you:

    https://stackoverflow.com/questions/21053138/c-sharp-hexadecimal-value-0x12-is-an-invalid-character

    Thanks,

    Mohit

  • Posted 9 June 2020, 2:07 am EST

    Hey Mohit,

    Thanks for the response.

    Just one thought, Do you guys have any plan to address this in feature because a lot of users is getting this error in their report, Do i need to include my manager to setup any call with grapecity support team for the same.

    Thanks

    Amit

  • Posted 10 June 2020, 2:25 am EST

    Hello,

    As I said earlier, this is by design. This is an XML issue. Not all symbols are valid for XML. We cannot do anything in this. However, I am discussing it with the development team. Currently, there is no need for a call and will inform you once I get any information from them.

    Thanks,

    Mohit

  • Posted 11 June 2020, 2:42 am EST

    Hello,

    As per the developer, It is by design. This is an XML issue. We cannot do anything in this. All characters from 0 to 31 are not supported.

    Sorry for the inconvenience caused to you.

    Thanks,

    Mohit

Need extra support?

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

Learn More

Forum Channels