We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Question: Open Excel with FileFormatType


I am using filestream to open and save excel workbook.

Can someone tell me how to use FileFormatType to open an excel file properly?

I can use workbook.Open(docFile) and workbook.Save(docFile), but to use filestream,especially when save workbook with stream, I need to provide a proper fileformat.

say I have these excel files:

test97.xls, test2000.xls, testxp.xls,test2003.xls, and test2007.xlsx,

based on extension, I can tell test2007.xlsx need to use

FileFormatType.Excel2007Xlsx to open, but how about the rest files all with same extension, can I use default format to open and save all other xls file?

such as :

docFile will be any my test***.xls file,

fstream = new System.IO.FileStream(docFile, FileMode.Open);

workbook.Open(fstream, FileFormatType.Default);


workbook.Save(docFile, FileFormatType.Default);

If this won't work, then what is right way to use fileformattype? Or is there anyway I can detect the excel version before try to open it?



Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Well, FileFormatType.Default is basically used for MS Excel 2003 file format but you can use FileFormatType.Default for all files from Office97 to Office 2003 having .xls extension (which are supported by MS Excel 2003).

Please check the following link to see the details about opening and saving the files using different FileFormatTypes,



Thank You & Best Regards,