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.
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.
Is there a type of excel button (form controls, activex controls or other) that is maybe better handled by infragistics?
When I loaded and saved out the file again, the chart was present, but the button was not. It looks like round-trip support for buttons and other forms was added for the 2003 formats, but not the 2007 formats. This can probably be fixed as a bug. I have forwarded this post to the Developer Support Manager and a DS engineer will be contacting you about this issue.
As far as what I meant earlier, I was simply saying that if the buttons are not round-tripped, it should not affect the rest of the data on your workbook or cause any exceptions when saving or loading the workbook. If it does, then this would be another bug.
The bug fix which added the support for round tripping forms in the Excel 2003 formats was fixed in versions 11.1 and later on 11/10/11 (the bug id is 90733). I don't believe the SR with this fix has been released yet. So when that is released, you can install the SR and it should work. If you find that it doesn't, please let me know.
Thank you for all your quick responses, it is very much appreciated.
We tried using an old Excel 97-2003 Worksheet with buttons in it, and the buttons were missing when that file was loaded as well.