I've managed to create a very basic macro enabled spreadsheet via OpenXML (merging a VBA macro from another spreadsheet along the way).
The generated spreadsheet opens up correctly in Excel - the macro is present, together with the data I've put in there.
However, when I try to use ClosedXML to open the file, I get a "NullReferenceException was unhandled" error message appear.
Here's the code for opening the file:
var nwb = new XLWorkbook("C:\\Temp\\ExcelTest.xlsm");
I've attached the file.
Any help would be appreciated...
Comments: I looked into this. It appears Closed XML fails to open this because there is no Stylesheet part on the workbook. I was able to mark some fixes that resolved these issues, but it appears this will need some more work to handle macrosheets. I am not sure what your full use cases is, but you may be able to work around this issue by adding a stylesheet part.
The generated spreadsheet opens up correctly in Excel - the macro is present, together with the data I've put in there.
However, when I try to use ClosedXML to open the file, I get a "NullReferenceException was unhandled" error message appear.
Here's the code for opening the file:
var nwb = new XLWorkbook("C:\\Temp\\ExcelTest.xlsm");
I've attached the file.
Any help would be appreciated...
Comments: I looked into this. It appears Closed XML fails to open this because there is no Stylesheet part on the workbook. I was able to mark some fixes that resolved these issues, but it appears this will need some more work to handle macrosheets. I am not sure what your full use cases is, but you may be able to work around this issue by adding a stylesheet part.