com.aspose.cells.CellsException: This file's format is not supported or you don't specify a correct format

Using: aspose-cells-8.1.2.jar

Execute environment:

2014-11-18 14:19:25,284 [main] INFO Java Version : 1.6.0_65-b14-466.1-11M4716
2014-11-18 14:19:25,284 [main] INFO Java Home : /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
2014-11-18 14:19:25,284 [main] INFO OS : Mac OS X
2014-11-18 14:19:25,284 [main] INFO OS Version : 10.10
2014-11-18 14:19:25,284 [main] INFO OS Architecture : x86_64


Here is the code (groovy)

boolean excelToPdf(File input, File output) {
try {
com.aspose.cells.Workbook workbook = new com.aspose.cells.Workbook(input.absolutePath)
mkdirs(output)
workbook.save(output.absolutePath, com.aspose.cells.SaveFormat.PDF)
return true
} catch (Exception ex){
notifyOnConversionFailure("excelToPdf failed on [${input.absolutePath}]", ex.getMessage())
onConversionFailed(output)
log.fatal ex.getMessage(), ex
}
return false
}

Here is the stacktrace:

at com.aspose.cells.Workbook.a(Unknown Source)
at com.aspose.cells.Workbook.(Unknown Source)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:77)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:102)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:52)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:198)
at com.boardontrack.AsposeLocalService.excelToPdf(AsposeLocalService.groovy:106)
at com.boardontrack.AsposeLocalService$excelToPdf.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at com.boardontrack.AsposeLocalService$excelToPdf.call(Unknown Source)
at com.boardontrack.PacketService.compilePacket(PacketService.groovy:114)


This exact code works fine for lots of other excel files.


Hi Richard,

Thanks for your posting and using Aspose.Cells.

This file is actually in a very old format which is not supported by Aspose.Cells. If you open it in MS-Excel and save it with Save As menu command, you will see MS-Excel will show you its format i.e

Microsoft Excel 5.0/95 Workbook (*.xls)

So this file is actually in a Microsoft Excel 5.0 or 95 format which is not supported by Aspose.Cells.

I have attached the screenshot for your reference.

You can also use this code to detect the FileFormatType of this file.

Java


FileFormatInfo finfo = FileFormatUtil.detectFileFormat(“Budget_Report_2014-2015_10_31_14_YTD_Compressed+copy.xls”);


System.out.println(finfo.getFileFormatType()== FileFormatType.EXCEL_95);

Console Output:
true

Hi,


Furthermore, FYI, Aspose.Cells supports BIFF8 or greater formats (Excel 97 - Excel 2010/2013), so you cannot read/write the Excel 95 or earlier file formats.

As a workaround, you may try the following steps to work with the file for Aspose.Cells product, so that Aspose.Cells could open/process the file fine, there is no alternative I am afraid:
e.g
Open your template file into MS Excel (e.g…,Ms Excel 2003 or 2007/2010).
Save the file As “Microsoft Office Excel Workbook”.
Now you can use Aspose.Cells to open/manipulate the file for your requirements, it will work fine.

Thank you.