NullReferenceException when using workbook.Save on an copied Excel file

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.

@ServerSide527,

Please notice, I am able to reproduce the issue as you mentioned by using your template file. I found NullReferenceException when using Workbook.Save on a copied Excel file. I have logged a ticket with an id “CELLSNET-47950” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@ServerSide527,
This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

1 Like

The issues you have found earlier (filed as CELLSNET-47950) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao