FileFormatType

Hi,

Is it possible to get the FileFormatType for a workbook? We need to check if a file is in the Excel 2007 format.

Thanks and best regards,
Ulf Ekström

Hi,

Thank you for considering Aspose.

Well, I am afraid Aspose.Cells does not provide any API which can be used to determine the file type. But, you may check it by your own code to determine the File Type by simply getting the file extension.

e.g.

.

.

.

String path = myFilePath;

String ext = path.substring(path.lastIndexOf(“.”), path.length());

if (ext.equals(“.xls”))

{

wb.open(myFilePath,FileFormatType.DEFAULT );

}

else if (ext.equals(“.xlsx”))

{

wb.open(myFilePath,FileFormatType.EXCEL2007 );

}

Thank You & Best Regards,

Very often we receive files with the .xls extention that are actually .xlsx files. Since extensions are easily changed it is not a reliable way of checking the file type.

Do you have any plans to provide methods for checking the actual types?

Best regards,
Ulf Ekström

Hi,

Thank you for considering Aspose.

We will check the feasibility for this feature, if we can support it for your requirement.

Thank You & Best Regards,

Hi,

Thank you for considering Aspose.

Please try the attached latest fix, we have supported a new method Workbook.getFileFormatType() to get the file format.

Thank You & Best Regards,

This is great news. Thank you so much for the quick fix.

Best regards,
Ulf Ekström