Upgrading from Aspose.Cells 8.6 to Aspose.Cells 24.1, SaveFormat.Xlsx

Hi,
We are using this code to save XLSX file, in works well with Aspose.Cells 8.6 :

saveOptions = new XlsSaveOptions(SaveFormat.Xlsx)
{
    CachedFileFolder = Path.GetTempPath(),
    ClearData = true
};
workbook.Save(filename, saveOptions);

But with 24.1 it saves a XLS file and not a XLSX file.

We saw that we can do :

workbook.Save(filename, SaveFormat.Xlsx);

But then how can we set following options :

  • CachedFileFolder = Path.GetTempPath(),
  • ClearData = true

@DomZ,

In newer versions of Aspose.Cells, you do not need to set or clear cached folder as the new library is optimized to do everything automatically and does not need this. You can try the following sample code to save to XLSX file format:

string filename = "e:\\test2\\Book1.xlsx";
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions(SaveFormat.Xlsx);
workbook.Save(filename, saveOptions); 

See the document on Saving files.
https://docs.aspose.com/cells/net/different-ways-to-save-files/

We are doing this for some other file formats :

saveOptions = new XlsSaveOptions(SaveFormat.Excel97To2003)
{
    CachedFileFolder = Path.GetTempPath(),
    ClearData = true
};
saveOptions = new TxtSaveOptions()
{
    CachedFileFolder = Path.GetTempPath(),
    ClearData = true,
    Encoding = Encoding.Unicode,
    Separator = _delimiter
};

And Aspose 24.1 is fine with these options for XLS/CSV formats.

Does the optimizations have been done for all formats, so I can remove this code for all ?

Thanks a lot.

@DomZ,

We will evaluate and get back to you with details.
Stay tuned.

@DomZ
1 ClearData
It works for Xml,xls, ooxml(xlsx,xlsm), xlsb.
2,CachedFileFolder
Only for xls.