Free Support Forum - aspose.com

Workbook.save deprecated- what's new syntax for fomat detecting

Hi,

I used this code to open an excel file, modify it and then return it in the same format (xls if the input file is xls, xlsx if the input file is xlsx, and so on). With the latest version of cells.dll, the worbook.save method I used is deprecated but I canot find how to replace it. Can you help me.

Regards,

Workbook excelFile = new Workbook(FUpload.PostedFile.InputStream);
MemoryStream ms;
ms = new MemoryStream();
excelFile.Save(ms, CellsHelper.DetectFileFormat(FUpload.PostedFile.InputStream));

Hi,

Thanks for using Aspose.Cells for .NET.

Please download and use the latest version:
Aspose.Cells
for .NET v7.3.2.3



The FileFormatType enumeration has been replaced with the SaveFormat enumeration. They map the same integer values.

In order to get rid of the warning, please upgrade your code in the following way.

C#


Workbook excelFile = new Workbook(FUpload.PostedFile.InputStream);

MemoryStream ms;

ms = new MemoryStream();


FileFormatType fmt = CellsHelper.DetectFileFormat(FUpload.PostedFile.InputStream);


SaveFormat saveFmt = (SaveFormat)fmt;

excelFile.Save(ms, saveFmt);

Thank you!

Have a nice day

Hi,

Thanks for using Aspose.Cells.

You are welcome. It’s good to know that above code was helpful for you to upgrade your existing code.

Let us know if you face any other issue, we will be glad to help you asap.