Aspose.Cells.Workbook.Save returns object reference not set to an instance of an object

Hi,



We are using version 7.6.1.0 of Aspose.Cells, and we have run into an issue with this method:



Aspose.Cells.Workbook.Save(stream, saveformat);



In most cases this works just fine, but when we tried it with a Excel file that contained cells with references to other objects in the sheet (in this form: {=calendar} ), we get this error:





[CellsException: Object reference not set to an instance of an object.]

Š.”.Š›(Stream ) +209

Aspose.Cells.Workbook.Save(Stream stream, SaveOptions saveOptions) +1130





When I remove the content of the cells that have the reference to {=calendar} - the error does not occur and all is well.





Attaching the file here



Thanks in advance for the help.

Hi,


Please try our latest version/fix: Aspose.Cells for .NET v8.6.3.4

I have tested using your template file and following sample code, it works fine and I do not get any exception and the output file is fine:
e.g
Sample code:

Workbook originalWorkbook = new Workbook(@“e:\test2\Excelprintbug.xlsx”);

using (var stream = new MemoryStream())
{
originalWorkbook.Save(stream, SaveFormat.Xlsx);
File.WriteAllBytes(@“e:\test2\outExcelprintbug1.xlsx”, stream.ToArray());
}


Since you are using an older version of the product, so we cannot evaluate or fix any issue (if found) in it. We recommend you to kindly upgrade to and try our latest version/fix of the product. If you still find any issue with v8.6.3.x, kindly do provide sample code (or preferably a simple console application (runnable)) to reproduce the issue on our end, we will check it soon.

Thank you.

Hi and thank you for the quick reply,

I’m sorry, I forgot to include our saveparameters in the post, we are using Aspose.Cells.SaveFormat.Pdf - does it work with the newer version when you use Pdf as saveformat aswell?

Hi,


Yes, it also works fine, the output PDF file is also fine tuned. See my updated code segment for your reference:
e.g
Sample code:

Workbook originalWorkbook = new Workbook(@“e:\test2\Excelprintbug.xlsx”);

using (var stream = new MemoryStream())
{
originalWorkbook.Save(stream, SaveFormat.Pdf);
File.WriteAllBytes(@“e:\test2\outExcelprintbug1.pdf”, stream.ToArray());
}

Thank you.

We updated our versions and it seems like the newer version solved the problem like you said, thanks!

Hi Christian,


Thank you for the confirmation. It is good to know that you are up & running again. Please feel free to contact us back in case you need our further assistance with Aspose APIs.