I’m trialling the Dotnet Core C# version of Aspose for a project and plan to use it on a Linux machine.
I’ve written some code that opens an XLSX file that was created in Excel, does stuff with the contents, and then saves the file to a different folder. Everything is working fine when run on a Windows machine.
However, when I run the code on Linux I get a NullReferenceException when saving the file.
EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object. at Aspose.Cells.Workbook.Save(String fileName, SaveOptions saveOptions)
The method signature in the error has filename and saveoptions, but I’m calling the save method which takes just a filename wb.Save(fullSavePath);
If I change it to wb.Save(fullSavePath, SaveFormat.Xlsx.); I get the same error.
It saves a file, but it is corrupt.
Details, steps I’ve taken and other info that might help
- Linux is Debian running in WSL.
- Aspose.Cells is the current version, 19.7.0
- I’ve installed TTF fonts in Linux, and set the Font Folder
- I save charts from the worksheet and these are saving fine on linux
- Using wb.Save(savePath + “test.xlsx”, SaveFormat.Xlsx); Throws the null exception and creates a corrupt file
- Using wb.Save(savePath + “test.csv”, SaveFormat.CSV); works and saves the first sheet
- Using wb.Save(savePath + “test.pdf”, SaveFormat.Pdf); works, and saves a PDF with all the sheets
- Using wb.Save(savePath + “test.xlsb”, XlsbSaveOptions(SaveFormat.Xlsb)); Throws the null exception and creates a corrupt file
- I’ve tried a stream, and that fails too.
Any help would be much appreciated.