Aspose.cells.workbook.open throws io error

Hi Rita,

Thank you for considering Aspose.

After further exploring your template file, we came to know that your file is basically a SpreadSheetML file and you can open the file using workbook.open(filename) method without providing any file format type.

Thank You & Best Regards,

Hi,

Thank you for taking a look at the template file again.

But I still can not use aspose.cells api to open the file.

here is the basic code

com.aspose.cells.Workbook workbook = new com.aspose.cells.Workbook();

workbook.open(srcFileName);

and srcFile-( DD633-4_2_4_6_09_5_40_PM_edited4DefaultStyle.xlsx) is as attached before.

Exception in thread "main" java.lang.NullPointerException

at com.aspose.cells.aG.a(Unknown Source)

at com.aspose.cells.fp.c(Unknown Source)

at com.aspose.cells.fp.b(Unknown Source)

at com.aspose.cells.fp.a(Unknown Source)

at com.aspose.cells.fp.e(Unknown Source)

at com.aspose.cells.fp.a(Unknown Source)

at com.aspose.cells.C.a(Unknown Source)

at com.aspose.cells.C.a(Unknown Source)

at com.aspose.cells.C.a(Unknown Source)

at com.aspose.cells.Workbook.a(Unknown Source)

at com.aspose.cells.Workbook.open(Unknown Source)

at com.aspose.cells.Workbook.a(Unknown Source)

at com.aspose.cells.Workbook.open(Unknown Source)

at aces.external.excel.aspose.AsposeWorksheetHelper.saveAsAsposeWorksheet2(AsposeWorksheetHelper.java:612)

at aces.external.excel.aspose.AsposeWorksheetHelper.main(AsposeWorksheetHelper.java:636)

Thanks again,

Rita

Note: If I manually open in MS Excel and save the file manually with right file format then I have no problem aspose.cells to open file. *orig.xlsx is the original source file and *edited4DefaultStyle.xlsx is edited for default Style.

Hi,

I don't find any problem opening both your files and saving them as xlsx or xml(spreadsheetml) formats. As we said earlier, both your files are actually spreadsheetml (.xml) files and these files are just given the extension as "xlsx" files, these files are not native Excel 2007 xlsx formats but spreadsheetml(xml) files (The files cannot be opened into MS Excel 2007 and you may open them into MS Excel 2003).

Following is my sample test code, I have tested both your template files and save them as xml(spreadsheetml) and xlsx file formats, everything works just fine:

Sample code:

//Creating a Workbook object
Workbook workbook = new Workbook();

//Calling open method of Workbook object to open the file. (the file is actually spreadsheetml but its extension is given as xlsx)
//workbook.open("e:\\files\\DD633-4_2_4_6_09_5_40_PM_orig.xlsx", FileFormatType.SPREADSHEETML);
//or open your second file.
workbook.open("e:\\files\\DD633-4_2_4_6_09_5_40_PM_edited4DefaultStyle.xlsx", FileFormatType.SPREADSHEETML);

//
// Perform your required operations
//

//Save as Xml spreadsheetml format.
workbook.save("e:\\files\\output_DD633-4_2_4_6_09_5_40_PM_edited4DefaultStyle.xml", FileFormatType.SPREADSHEETML);
//or you can save the file as originalExcel2007 xlsx format.
//workbook.save("e:\\files\\output_DD633-//4_2_4_6_09_5_40_PM_edited4DefaultStyle.xlsx", FileFormatType.EXCEL2007);

I have also attached the output file after executing the above code and you may open the file into MS Excel 2003 to check its contents.

Thank you.

Hi Amjad,

Thanks again for taking a look at the template files.

But I get the same error messages as before while trying out the exact sample code with new version of Aspose.Cells for java. I have tried both Aspose.Total for Java and Aspose.Cells for Java V2.0.1 Hotfix . So could you please let me know once more the version that you may be working with.

Thanks again,

Rita.

Hi,

Well, I am using the attached latest fix(2.0.1.6), could you try it and let us know.

By the way, you should make sure that you are using the latest version of the component, for reference, please check the doc topic: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/check-version-number-of-the-component.html

e.g (you may use the code for confirmation)

Workbook workbook = new Workbook();

System.out.println(CellsHelper.getReleaseVersion());

Thank you.

Hi Amjad,

Thank you for the 2.0.1.6 version of Aspose.Cells for java- with that version able to open and save the file. When that version would be available to download from ASPOSE product down load site?

Thanks a lot for your help.

Rita

Hi Rita,

Thank you for considering Aspose.

Well, you can use the fix (Aspose.Cells for Java 2.0.1.6) as an official release. It is an intermediate kind of version which is provided as a fix against some bugs. Normally, a bug fix version is posted in the support forums. You can use this fix for your requirements; it will behave like an official release. It is to be noted here, our next official release would include all the functionality of the previous fixes (including all the intermediate versions till the next official release).

Thank You & Best Regards,

Hi,

This feature has been supported. Please download the latest version: Aspose.Cells for Java 7.0.1