We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

String cannot be cast to java.lang.Double error while converting worksheet to image using Aspose.Cells for Java

When generating preview of xlsx file it will gives me Cell Exception.

Problem is with D7 cell. It contains value as ‘NA’ change it with 0 it works fine.

Code for generating preview
 Workbook workbook = new Workbook(filepath);
WorksheetCollection worksheetCollection = workbook.getWorksheets();
ImageOrPrintOptions imgOptions = new ImageOrPrintOptions();
for (int i = 0; i < worksheetCollection.getCount(); i++) {
Worksheet worksheet = worksheetCollection.get(i);
SheetRender sr = new SheetRender(worksheet, imageOrPrintOptions);
for (int j = 0; j < sr.getPageCount(); j++) {
String imageFilePath = FileUtils.getAbsoluteFilePath(destinationFilePrefix + (noOfImages++), configurationInfo.getPreviewType().getType());
sr.toImage(j, imageFilePath);

Hi Ashish,

Thanks for your posting and using Aspose.Cells for Java.

We were able to observe this exception by running your code with the latest version: Aspose.Cells for Java (Latest Version) using your source file. If we change the value of cell D7 to 0, then this exception does not occur.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as CELLSJAVA-40723


Please try the attached version/fix: Aspose.Cells for Java v7.7.1.5 (attached).

We have fixed your issue now.

Let us know your feedback.

Thank you.

The issues you have found earlier (filed as CELLSJAVA-40723) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.