Free Support Forum - aspose.com

Selecting the version of excel file to be opened

Hi,

I have requirement to open the excel files of different versions (ranging from 95 to 2007) but while opening and saving them using aspose.cell we have to specify the version of excel. How we will come to know in runtime the version of file to be opened?

FileFormatType.Default is not able to detect version automatically and open the excel file.

For excel 2003 it works fine.

It will great if you can provide example of opening the excel of any version without specifying in code the specific version.

Regards,

Ashish

Hi Ashish,

Thanks for considering Aspose.

Well, First of all, Aspose.Cells does not support the file format type for Excel 95 or earlier versions. It supports BIFF8 or greater file formats ranging from MS Excel 97 - MS Excel 2007. Now come to your question, for your info, there is not much internal difference b/w Excel 97-Excel2003 file format types. If your file is .xls (MS Excel 97-MS Excel 2003), you don't need to provide file format type all the time, you may skip it and use Workbook.Open(fileName) and Workbook.Save(fileName) methods without any problem as Aspose.Cells will automatically set the proper format type for the file while loading/saving the excel file. When you use Workbook.Open/Save (fileName, FileFormatType.Default), Aspose.Cells will open/save the file with the default MS Excel 2003 file format type.

When you use (open/save) .xlsx file format (MS Excel 2007), this time you do need to provide FileFormatType.Excel2007Xlsx format type.

Thank you.