Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export grid to excel, hexadecimal value 0x1D, is an invalid character. #413

Closed
RedSoxXx opened this issue Apr 22, 2024 · 4 comments
Closed

Comments

@RedSoxXx
Copy link

If grid row column contains � symbol, export crash the system.

for exmple column string:

0104066752617374215&HY7wBKPSzSF�91EE09�921+/yC17ohCznulAYWaWbHLL3oHwVY+pvaKsvJZ9i8CI=

@gustavnavar
Copy link
Owner

I've tried to reproduce this error with a column value "zSF�91EE09�921+/yC17ohC" and everything is working fine.

Are you using WASM or Blazor Server?

Could you send me a project with a grid producing this error?

@RedSoxXx
Copy link
Author

@gustavnavar Blazor Server, please try with \ u001d unicode symbol, reproduced only if this unicode simbol in string, if you will not able to reproduce, I will create small project with example

@gustavnavar
Copy link
Owner

gustavnavar commented Apr 25, 2024

I could reproduce it inserting \u001d unicode character in a text field of the database.

I get this exception:

Unhandled exception rendering component: '�', hexadecimal value 0x1D, is an invalid character.
      System.ArgumentException: '�', hexadecimal value 0x1D, is an invalid character.
         at System.Xml.XmlUtf8RawTextWriter.InvalidXmlChar(Int32 ch, Byte* pDst, Boolean entitize)
         at System.Xml.XmlUtf8RawTextWriter.WriteElementTextBlock(Char* pSrc, Char* pSrcEnd)
         at System.Xml.XmlUtf8RawTextWriter.WriteString(String text)
         at System.Xml.XmlWellFormedWriter.WriteString(String text)
         at DocumentFormat.OpenXml.OpenXmlLeafTextElement.WriteContentTo(XmlWriter w)
         at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter)
         at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
         at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter)
         at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
         at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter)
         at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
         at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter)
         at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
         at DocumentFormat.OpenXml.OpenXmlElement.WriteTo(XmlWriter xmlWriter)
         at DocumentFormat.OpenXml.OpenXmlCompositeElement.WriteContentTo(XmlWriter w)
         at DocumentFormat.OpenXml.OpenXmlPartRootElement.WriteTo(XmlWriter xmlWriter)
         at DocumentFormat.OpenXml.OpenXmlPartRootElement.Save(Stream stream)
         at DocumentFormat.OpenXml.OpenXmlPartRootElement.SaveToPart(OpenXmlPart openXmlPart)
         at DocumentFormat.OpenXml.OpenXmlPartRootElement.Save()
         at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.TrySavePartContent(OpenXmlPart part)
         at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.SavePartContents(Boolean save)
         at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose(Boolean disposing)
         at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Dispose()
         at GridBlazor.ExcelWriter.GenerateExcel(ExcelData data) in C:\Users\GustauNavarro\source\repos\Grid.Blazor\GridBlazor\ExcelWriter.cs:line 201
         at GridBlazor.ExcelWriter.GenerateExcel[T](IGridColumnCollection`1 columns, IEnumerable`1 items) in C:\Users\GustauNavarro\source\repos\Grid.Blazor\GridBlazor\ExcelWriter.cs:line 168

@gustavnavar
Copy link
Owner

Package 5.0.12 cleans all excel cell content (remove all XML invalid characters) before export is done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants