I am getting a "System.NullReferenceException: Object reference not set to an instance of an object." error when trying to load this specific Excel file (XmRChartPIR.xlsm). this excel template has a number of macros, buttons and charts.
I have been able to successfully load other files (.xlsm, .xlt, .xls) that are less complicated. Is there something I can do to load the Excel file I am having problems with?
Code:
Dim FileString As String = "...\Excel\XmRChartPIR.xlsm"
Dim exWB As New
Infragistics.Documents.Excel.Workbook()
exWB = Infragistics.Documents.Excel.Workbook.Load(FileString)
StackTrace:
NullReferenceException: Object reference not set to an instance of an object.]Infragistics.Documents.Excel.Serialization.Excel2007.SharedElements.Drawing.BlipElement.Load(Excel2007WorkbookSerializationManager manager, ExcelXmlElement element, String value, Boolean& isReaderOnNextNode) +539 Infragistics.Documents.Excel.Serialization.Excel2007.XmlElementBase.LoadChildElements(Excel2007WorkbookSerializationManager manager, ExcelXmlNode node, ExcelXmlDocument document, XmlReader reader, ElementDataCache elementCache, List`1 elementCacheCollection, BeforeLoadElementCallback beforeLoadElementHandler, AfterLoadElementCallback afterLoadElementHandler, Boolean& isReaderOnNextNode) +565 Infragistics.Documents.Excel.Serialization.Excel2007.XmlElementBase.LoadChildElements(Excel2007WorkbookSerializationManager manager, ExcelXmlNode node, ExcelXmlDocument document, XmlReader reader, ElementDataCache elementCache, List`1 elementCacheCollection, BeforeLoadElementCallback beforeLoadElementHandler, AfterLoadElementCallback afterLoadElementHandler, Boolean& isReaderOnNextNode) +632
Do you have any externally linked images in the workbook? If so, this bug has been fixed and should be available in the next SR. If not, could you attach the workbook to the thread and I'll try loading it on my system?
There was an image, i don't think it was "externally linked" but I removed it anyway. Now I am getting a different error.
XmlException:
The 'br' start tag on line 19 does not match the end tag of 'font'. Line 20, position 26.
Unfortunately I cannot post the Excel Template, but I am trying to get permission to do so. We are slowly stripping functionality to see when we can get it to work again.
We are using 2011.2
Ok then it must be a new issue. The only way we can find and fix the issue is if we can reproduce it here. Having the file would help, but if you are unable to post it or send it to Developer Support, continue trying to remove things from it until it works again. When you get it working, try to add the last thing you removed to a new workbook and see if the same issue happens with that. If so, maybe that will be something you can send.
There are developer buttons placed in the worksheets to trigger events. I removed one of these buttons and was able to load and export data to the worksheet, but the sheet that opens up is stripped of ALL the remaining developer buttons on all the sheets.
Is there any known issues with buttons in excel?
Previously, they were not supported at all. I believe some round-trip support was added for them recently, but if they are not being round-tripped in your file, that can be submitted as a bug so round-trip support can be extended for this scenario. However, they should not be causing any a problem even if they are ignored.
"However, they should not be causing any a problem even if they are ignored."
I'm not sure I follow, what shouldn't be causing a problem?
The buttons and charts that are being stripped from the excel workbook are very important to the data that I am loading into one of the sheets. If infragistics can't return a sheet with the buttons and charts intact then the Export Excel feature is useless.
Here is a simple sheet I am using to test. I can load this workbook and write data to a new sheet, but the Button on sheet 1 disappears. The chart however remains in the new workbook.
In my real application I need those buttons to generate charts. I can load the workbook, and write data to a new sheet, but all of the buttons and charts are missing.