本帖最后由 ANET 于 2024-2-26 16:28 编辑
问题描述:
AR Section Report, 同样的报表,导出 pdf/html正常,用ArExports.Excel.Section.XlsExport导出xls也没问题,
用ArExports.Excel.Section.XlsExport导出xlsx的时候报如下错误,仅少数报表有这个问题,其它大部分报表导出xlsx也正常,
System.Exception: Error running report ---> System.ArgumentException: '.', hexadecimal value 0x00, 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.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.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 GrapeCity.ActiveReports.SpreadBuilder.I.?.?(Stream ?)
at GrapeCity.ActiveReports.SpreadBuilder.I.?.Export(Workbook workbook, Stream outputStream)
at ReportRunner.RunReport(SectionReport rpt, Boolean bGenerateStream, Boolean bSetExcelMinColWidth, Boolean bEnableExcelCellMerging) in C:\Code\AN\rserver-ii\RServerII\ReportRunnerBase.vb:line 1034 --- End of inner exception stack trace ---
at ReportRunner.RunReport(SectionReport rpt, Boolean bGenerateStream, Boolean bSetExcelMinColWidth, Boolean bEnableExcelCellMerging) in
想问下有没有参数设置啥的,让XML不用校验内容直接导出,我看网上有如下设置的:
XmlWriterSettings writerSettings = new XmlWriterSettings();
writerSettings.CheckCharacters = false;
但是咱们没直接用到这个类,想问下该如何设置,谢谢。
|