For some reason, starting (I think) with 8.3.20083.2059 I've started getting an xml exception when trying to export a grid.
I'm trying to identify the cause but so far I'm stumped as the code that I have to build the report has not changed and the exception appears to be down in the bowles of the export function.
2009-04-27 11:42:31,726 [10] ERROR TastingMaster.TastingEntry [(null)] - An error occurred while parsing EntityName. Line 1, position 50.System.Xml.XmlException: An error occurred while parsing EntityName. Line 1, position 50. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.Throw(String res, String arg) at System.Xml.XmlTextReaderImpl.Throw(String res) at System.Xml.XmlTextReaderImpl.ParseEntityName() at System.Xml.XmlTextReaderImpl.ParseEntityReference() at System.Xml.XmlTextReaderImpl.Read() at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace) at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader reader) at Infragistics.Win.UltraWinGrid.DocumentExport.Utilities.SplitContent(String formattedText) at Infragistics.Win.UltraWinGrid.DocumentExport.Utilities.MeasureFormattedText(String formattedText, Single width, Font baseFont, AppearanceData& defaultAppearance, ISection section, Size& textSize) at Infragistics.Win.UltraWinGrid.DocumentExport.GraphicsCache.MeasureFormattedText(String text, Single cellWidth, Font baseFont, AppearanceData& appearance) at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.ProcessGridRowInternal(UltraGridExporterHelper ultraGridExporterHelper, UltraGridRow row, ProcessRowParams processRowParams) at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridExporterHelper.Infragistics.Win.UltraWinGrid.IUltraGridExporter.ProcessRow(UltraGridRow row, ProcessRowParams processRowParams) at Infragistics.Win.UltraWinGrid.RowsCollection.InternalTraverseRowsHelper(IUltraGridExporter exporter) at Infragistics.Win.UltraWinGrid.RowsCollection.InternalTraverseRowsHelper(IUltraGridExporter exporter) at Infragistics.Win.UltraWinGrid.RowsCollection.InternalTraverseRowsHelper(IUltraGridExporter exporter) at Infragistics.Win.UltraWinGrid.UltraGrid.Export(IUltraGridExporter exporter) at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.Export(UltraGrid grid, ISection section) at Infragistics.Win.UltraWinGrid.DocumentExport.UltraGridDocumentExporter.Export(UltraGrid grid, Report report) at TastingMaster.TastingEntry.BuildReport(UltraGrid reportGrid, String reportTitle) in D:\TastingMaster\Source\TastingMaster\TastingMaster\Framework\TastingEntry.cs:line 903 at TastingMaster.TastingEntry.ReportExport(UltraGrid reportGrid, String fileName, FileFormat exportFormat, String reportTitle) in D:\TastingMaster\Source\TastingMaster\TastingMaster\Framework\TastingEntry.cs:line 968
Has anyone seen this error before and have a suggestion or is there a way to capture whatever xml file the text reader is trying to read to see if I can find anything out from that?
Neil
Hi Neil,
If having an "&" character in your data is causing the Export method to raise an exception, then that's a bug in the exporter, you should not have to fix it in your code. Are you sure that's what is happening?
I tested this out by placing an "&" in a string column and the grid and then exporting it and it worked just fine for me.
Hi Mike,
Yes, I'm sure that this was the problem. When I changed the code so that the "&" was encoded as "&" I was able to export the same grid to both PDF and Excel. Before that, it would fail with the listed exception.
As I indicated initially, I think this is new with the last hotfix of 8.3 although I'm not 100% sure when the application began to fail as it is in an area that is not used that often. I've not tried this on 9.1 to see if the issue exists in that version.
Hello Neil,
I have created a support case on your behalf, so we can continue the discussion there.
Regards,
Alex.
Aha! That did it. Once I change the column style, I get the same exception. I'm glad you were able to work around it, but you really shouldn't have to. I'm going to forward this post over to our Developer Support group so they can write this up for developer review and get it fixed.
One more thng, just to make sure I'm clear. The column in the grid is defined with style of FormattedText.
The string that was failing was something like the following
"Some stuff & things<br/>anotherline<br/>and more"
Exporting this would fail for me, however
"Some stuff & things<br/>anotherline<br/>and more"
would work.