Home » excel » .net – Export to Excel doesn't work for Excel 2013

.net – Export to Excel doesn't work for Excel 2013

Posted by: admin May 14, 2020 Leave a comment

Questions:

We’re using a deprecated ActiveX control (OWC) in a web application. Even though the control is deprecated, the control still works without any problems except that the “Export to Excel” button does not work with Excel 2013 (works on other versions of Excel). Under other versions of Excel, the ActiveX control will open up Excel with a link to the OLAP cube already set up.

We’re trying to figure out why it works on older versions but not Excel 2013. Any ideas?

How do programs usually do the export? Do programs look up the location of Excel in the registry and then run it?

How to&Answers:

This appears to be a bug in Microsoft Excel 2013’s XML Spreadsheet 2003 file loader. Internally when you export from OWC11 to Excel, the OWC component makes a XML Spreadsheet 2003 file and embeds it into a HTML document. You can see this by clicking File and then ‘Properties’, going to the folder that it says the document is and editing the document with a Text editor. It will have a .htm extension but Excel ignores all but the internal XML document. Anyway… If you remove all of the filters of the pivot items (If all of the pivot items are selected), Excel 2013 can load the file. Once you filter some of the results by dropping down the pivot item and unchecking one of the items… Then, export to Excel 2013.. and Excel 2013 crashes. If you compare one that works in Excel 2013 and one that crashes Excel 2013, you will see that it’s the presence of the a Hidden tag that causes Excel 2013 to crash. You can even reproduce the issue directly in Excel2013 by loading an unfiltered document cube, exporting to Excel 2013.. , filtering in Excel 2013. Saving as a XML Spreadsheet 2003. Then closing it. And opening the saved filtered document. Insta-crash. This is clearly an Excel 2013 bug because the original document doesn’t have a Hidden Tag. When you filter it in Excel 2013 and then save it as XML Spreadsheet 2003, Excel adds the hidden tag. When loading the document next time, excel crashes when it encounters the hidden tag. If you remove the hidden tag from the saved document with a text editor, Excel is able to load it again but nothing is filtered. If you can get Microsoft to fix this bug, that would be great :).