Hello,
I encountered ArrayIndexOutOfBoundsException error when trying to convert excel to PNG.
Environment:
- GroupDocs 1.3.0 Java
- JDK 8
Error:
com.groupdocs.conversion.exception.CorruptFileException: File extension of filename Can’t convert cells to html! cannot be opened, and looks to be corrupted.
at c.toImage(Unknown Source)
at aa.a(Unknown Source)
at com.groupdocs.conversion.handler.ConversionHandler.convertToImage(Unknown Source)
at com.test.converter.GroupDocsConverter.getPage(GroupDocsConverter.java:159)
at com.test.converter.GroupDocsConverter.getDocContent(GroupDocsConverter.java:137)
at com.test.converter.main.GetPageContentApp.main(GetPageContentApp.java:33)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.elementData(ArrayList.java:418)
at java.util.ArrayList.get(ArrayList.java:431)
at com.groupdocs.conversion.internal.c.a.c.ia.a(Unknown Source)
… 6 more
Hello,
Thank you for your inquiry.
We have tested your document with such code:
ImageSaveOptions imageSaveOptions = new ImageSaveOptions();
imageSaveOptions.setSaveFileType(ImageSaveOptions.PNG);
imageSaveOptions.setAsListItems(true);
imageSaveOptions.setSavePath("save path");
ArrayList<String> list;
imageSaveOptions.setSaveName("file_name");
imageSaveOptions.setSplitWorksheetIntoPages(false);
imageSaveOptions.setWorksheetIndex(1);
list = conversionHandler.convertToImage("path to file", imageSaveOptions);
and your document was converted well, as you can see on a screenshot.
Could you please share with us your code example of the conversion? Seems that you use incorrect configuration for Cells formats.
We will wait for your details.
Best regards,
Evgen Efimov
http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+.
Hello,
This is the code that I used:
ImageSaveOptions options = new ImageSaveOptions();
options.setSaveFileType(FileType.PNG);
options.setResolution(300);
options.setPage(pageNum);
Thank for you helping me solving the issue.
Hello,
Thank you for your code.
Please add this code line options.setWorksheetIndex(0) to your code . It should resolve your issue.
This parameter is required , because the Conversion library should know which worksheet it will convert.
If you will have more questions please feel free to contact us.
-------
Best regards,
Evgen Efimov
http://groupdocs.com
Your Document Collaboration APIs
Follow us on LinkedIn, Twitter, Facebook and Google+