Hello,
I’ve been getting a System.NullReferenceException when trying to copy a workbook from an input excel file, and then saving it. An example code snippet is as follows:
Workbook workbook = new Workbook();
Workbook original = new Workbook(@"C:\[directory]\testFile.xlsx");
workbook.Copy(original);
workbook.Save(@"C:\[directory]\Output.xlsx");
The error occurs when trying to run workbook.Save, specifically after using workbook.Copy on the attached excel file. If I do not copy it, then it is able to save correctly. Also the issue seems to occur specifically on this excel file, and saves correctly on other files.
Furthermore, if I were to save the original file using workbook.Save, and then use the output file as input to my code (copying then re-saving it), it works as expected.
Here is the aforementioned excel file along with a version that works correctly:
nullexcep_testfiles.zip (83.5 KB)
Thanks.