Hi,
I’m evaluating the product Aspose.Cells for Java.
I’m trying to perform the following file conversions:
1. Excel 97-2003 to Excel 2007(Both XLSX & XLSM format).
2. Excel 2007(Both XLSX & XLSM format) to Excel 97-2003.
3. Excel 2007(XLSX) to Excel 2007(XLSM).
4. Excel 2007(XLSM) to Excel 2007(XLSX).
For conversion 1, 3 & 4, the workbook is saved successfully, but when I open those workbooks, I get the following warning:
“Excel found unreadable content in <workbook_name>.Do you want to recover the contents of this workbook? If you trust the source of this workbook,click Yes.”
On clicking Yes, the following message is shown:
“Removed Records: Named range from /xl/workbook.xml part (Workbook).”
Also, the macro in the workbooks are not saved after conversion.
For conversion 2, I get an ArrayIndexOutOfBoundsException. The stacktrace is:
Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 6
at com.aspose.cells.gJ.c(Unknown Source)
at com.aspose.cells.gJ.g(Unknown Source)
at com.aspose.cells.fH.a(Unknown Source)
at com.aspose.cells.fH.a(Unknown Source)
at com.aspose.cells.Shape.a(Unknown Source)
at com.aspose.cells.gc.b(Unknown Source)
at com.aspose.cells.gc.a(Unknown Source)
at com.aspose.cells.dv.b(Unknown Source)
at com.aspose.cells.dv.y(Unknown Source)
at com.aspose.cells.dv.a(Unknown Source)
at com.aspose.cells.Workbook.save(Unknown Source)
at ExcelAspose.save(ExcelAspose.java:75)
at ExcelAspose.xlsmToXls(ExcelAspose.java:49)
at ExcelAspose.main(ExcelAspose.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
Attached is the templates that are being used for conversion and the templates obtained after conversion.
The source code is:
public void xlsToXlsm() throws Exception{
save(getXLSWorkbook(), “Template XLS to XLSM.xlsm”, FileFormatType.EXCEL2007XLSM);
}
public void xlsxToXlsm() throws Exception{
save(getXLSXWorkbook(), “Template XLSX to XLSM.xlsm”, FileFormatType.EXCEL2007XLSM);
}
public void xlsToXlsx() throws Exception{
save(getXLSWorkbook(), “Template XLS to XLSX.xlsx”, FileFormatType.EXCEL2007);
}
public void xlsmToXlsx() throws Exception{
save(getXLSMWorkbook(), “Template XLSM to XLSX.xlsx”, FileFormatType.EXCEL2007);
}
public void xlsmToXls() throws Exception{
save(getXLSMWorkbook(), “Template XLSM to XLS.xls”, FileFormatType.EXCEL97TO2003);
}
public void xlsxToXls() throws Exception{
save(getXLSXWorkbook(), “Template XLSX to XLS.xls”, FileFormatType.EXCEL97TO2003);
}
public Workbook getXLSWorkbook() throws Exception{
Workbook xls = new Workbook();
xls.open(inputDirectory + “Mod Template XLS.xls”, FileFormatType.EXCEL97TO2003);
return xls;
}
public Workbook getXLSMWorkbook() throws Exception{
Workbook xlsm = new Workbook();
xlsm.open(inputDirectory + “Mod Template XLSM.xlsm”, FileFormatType.EXCEL2007XLSM);
return xlsm;
}
public Workbook getXLSXWorkbook() throws Exception{
Workbook xlsx = new Workbook();
xlsx.open(inputDirectory + “Mod Template XLSX.xlsx”, FileFormatType.EXCEL2007);
return xlsx;
}
public void save(Workbook workbook, String name, int type) throws Exception{
workbook.save(outputDirectory + name, type);
}
Can you please provide a solution for the above mentioned problems?
Apart from the file conversions, I’ll be performing evaluation to see if following features are supported:
1. Pasting charts as graphics.<o:p></o:p>
2. Evaluating formulas and pasting their results as values. After which the formula should be deleted.
3. Allow setting passwords to open and modify workbooks.
4. Hiding, Deleting and Advanced Hiding a sheet.
5. Deleting macro code from a xls, xlsx or xlsm files.
It would be very helpful if you could provide some reference to whether the above things be achieved.
Kulbhushan Singhal.