Converting Excel to PDF - Shape to Image Error

Hey !
I am trying to convert xlsx & xls files to pdf . I have been doing it in the below mentioned way, but I get issues with some files (having images,etc as per my observation) - Shape To Image Error. (Currently using Aspse.Cells - 19.5 for JAVA )
I tried finding the solution for this and found a thread already with the same issue. But, I followed the solution suggested by you guys to use Aspose Cells 20.9 and still get the same issue. Please let me know how to get through this issue.

Code for XLSX to PDF Conversion -

String sourceFilePath = “D:\FILES\”+fileName;
String destFilePath = “D:\PDF_Documents\”;
Workbook wbxlsx = new Workbook(sourceFilePath);
wbxlsx.save(destFilePath+fileName+"_PDF.pdf");

Thank you !

@Kushal.20m

We need your template Excel file to evaluate your issue. Please zip your file(s) and attach it here, we will check your issue soon.

Sure. Please find the files which are producing this issue as attached.ERROR_FILES.zip (5.4 MB)

@Kushal.20,

Please note, your files are corrupt. For confirmation, I checked your both files by opening the files into MS Excel 2007, 2013, etc.) and found MS Excel prompt error messages and have to repair certain drawing objects records/parts before loading these into it.

Moreover, please try our latest version/fix: Aspose.Cells for Java v20.9.8 (attached)
aspose-cells-20.9.8-java.zip (7.2 MB)

I tested your scenario/case and it works one of your provided files (i.e.,“16312.xlsx”) and generates output PDF file fine. But it does not work with other file, it seems your other files has more damaged drawing objects records which cannot be evaluated by Aspose.Cells for rendering. Please provide a valid Excel files which should be opened fine without any restoration or error messages, we will check it soon.

Yes, I am aware about that.
Actually, it got corrupted when i converted that file from .xls to .xlsx using Aspose Cells (because I want only xlsx files and since it is the xls format so I need to first convert it into xlsx)
I am sending you the original xls version of both the files in the zip. Kindly find that and try to convert it into xlsx first(would make the file corrupt) for further conversion into pdf and let me know the solution for the same.

Code used for conversion of xls into xlsx -

String sourceFilePath = “D:\ERROR_FILES\”+fileName;
String destFilePath = “D:\ERROR_FILES\”;

Workbook wbxlsx = new Workbook(sourceFilePath);
wbxlsx.save(destFilePath+fileName+"_DEMO.xlsx", SaveFormat.XLSX);

Also, find the original xls files here - XLS_FILES.zip (5.5 MB)

@Kushal.20,

I tested your original XLS files and both are corrupt. I tried to open these files into MS Excel 2013 and found an error message, see the screenshot for your reference.
sc_shot1.png (39.3 KB)

But, with these original (xls files) I am not getting any error messages. I am able to open these files on Office 365 and even on Excel 2007. I’ve checked it again. Please try to open on any of them and then try to convert as mentioned in the above message.

@Kushal.20,

Since MS Excel (e.g 2007) and Office 365 finally open the files ok, so we will evaluate and try to fix it (if possible). We can get “Shape to image” error with the generated XLSX files (re-saved by Aspose.Cells). But, we think, the issue XLS --> XLSX should be addressed at first and it is possible that Shape to image error is due to corrupted output XLSX file by Aspose.Cells APIs. We have logged a ticket with an id “CELLSJAVA-43315” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

@Kushal.20,
This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@Kushal.20,
Please try our latest version/fix: Aspose.Cells for Java v20.10.7:
aspose-cells-20.10.7-java.zip (7.2 MB)

Your issue should be fixed in it.

Let us know your feedback.

The issues you have found earlier (filed as CELLSJAVA-43315) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi