Aspose.Cells prior to v21.11 was throwing the CellsException with text “This file’s format is not supported or you don’t specify a correct format.” when I was trying to create a Workbook instance from an SVG file. Now, after upgrading to 21.11, it stopped throwing the exception. I can create the Workbook and see the SVG image inside the xlsx file after I save the Document. However, when I save the Document as a PDF file, the resulting file is empty. I use the PDF output format a lot in my app, so I would like to know whether the SVG format is now supported and the xlsx to pdf conversion is failing, or SVG format is not supported and the fact that it stopped throwing the mentioned CellsException is a regression issue? Thank you.
The PDF rendering might have some limits. Could you please zip and attach your sample SVG file and paste your sample code that you are using. We will check your issue soon.
Here is my code snippet. EXCEL_TEST_FOLDER is a Path instance into the directory with test files.
Path input = EXCEL_TEST_FOLDER.resolve("image.svg");
Workbook document = new Workbook(input.toString());
PdfSaveOptions options = new PdfSaveOptions();
Path tempFile = Files.createTempFile("pdfconv-", null);
document.save(tempFile.toString(), options);
InputStream pdfIs = Files.newInputStream(tempFile, StandardOpenOption.DELETE_ON_CLOSE);
com.aspose.pdf.Document pdfDoc = new com.aspose.pdf.Document(pdfIs);
pdfDoc.save(EXCEL_TEST_FOLDER + "/output.pdf");
I noticed the issue as you mentioned using your sample SVG. I have logged a ticket with an id “CELLSJAVA-44274” for your issue. We will evaluate the issue and give you details on why SVG file format is read while instantiating a Workbook and not throwing exception anymore.
We will get back to you soon.
We are pleased to inform you that we have fixed your issue now. The fix will be included in our next (upcoming) version Aspose.Cells for Java 22.2.
Thank you. So it will throw the CellsException again, correct?
The issues you have found earlier (filed as CELLSJAVA-44274) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi