Cells - wb.Save not perserving original documents fileFormatType

Perhaps its just my assumtion, but…
If I have a xlsx file and call Workbook.Save(fileName) the format seems to be changed from xlsx to xls
then when I try to open my new document I get an error from excel… “Excel cannot open the file ‘myfile.xlsx’ because the file format of file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.”
If I change the extension of the file to .xls it opens fine, or if I start with a xls file it saves fine, or if I call Workbook.Save(fileName, Aspose.Cells.FileFormatType.Excel2007Xlsx) it works fine – This is not ideal because my source file format type may differ from xlsx to xls

Do i have to look at the fileFormatType of my source filemy file before saving and save accordinly, or is this a bug in your software that is not preserving the FileFormatType? If I have to look before save how do I get the original fileFormatType? I could look at the file extension but that is not always accurate.


Hi,

No, it's not a bug. Currently, we only support fileformattype auto-detection (for .xls and .xlsx files) when you open the file using Workbook.Open() method. I think you can do it according to the extension of the file and specifying the related fileformattype when saving the file.

We can implement your desired feature but I'm afraid some users may not want it to be implemented.

Thank you.

You say currently you only support fileformattype auto-detection when you open the file using Workbook.Open(), and that is exactly what I am doing. I Workbook.Open() a xlsx file and then Workbook.Save() that file I expect it to save in the xlsx format. If I Workbook.Open() an xls file and then Workbook.Save() that file I expect teh format to be xls.
Currenly I am experincing this: I Workbook.Open() an xlsx file and then Workbook.Save() that file the extension is xlsx but the format is now xls (I dont want this, the format shoul stay xlsx)

Hi,

Thanks for providing us further details.

We will check the feasibility of your desired feature if we can implement it for your need.

Thank you.

Hi,

We have supported FileFormatType auto-detection while saving the excel file using Workbook.Save() method similar to Workbook.Open() method, so you don't need to provide FileFormatType while saving the file anymore.

A fix would be available soon for you.

Thank you.

Hi,

Kindly try the Aspose.Cells version 4.5.0.3 posted @: <A href="https://forum.aspose.com/t/88644</A></P> <P>Thank you.</P>

That works. Problem solved.
Thank you much =)