SVG export creates invalid stroke-linecap="flat" attributes

When exporting to SVG (using SheetRender API), Aspose Cells will sometimes generate attributes as following:

stroke-linecap="flat"
This is not a valid value according to the SVG specification. Most likely the “butt” value should be used instead. Since Aspose Cells is producing invalid SVG, this breaks some other tools (like Apache Batik) that will process the produced SVG.

Hi,

Thanks for providing us some details.

Well, if you use Workbook.Save() to render to SVG, it would actually render TIFF file, we already logged a ticket into our database to fix it soon. It looks like you are using SheetRender APIs to render to SVG file format. Could you provide the template file(s) and sample code here to evaluate your issue on our end. We will check it soon.

Thank you.

I’ve attached the source .xlsx file. Sample code:

Workbook  workbook = new Workbook(“c:/dev/sample.xlsx”);
Worksheet sheet = workbook.getWorksheets().get(0);
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.setSaveFormat(SaveFormat.SVG);
new SheetRender(sheet, options).toImage(0, “c:/dev/sample.svg”);
You can try a service like The W3C Markup Validation Service to see that the generated SVG is rejected as invalid.

Hi,


Thanks for the template file and sample code.

I observed the issue as you mentioned. I used your template file
to render to SVG file format using the following sample code. The
output SVG is invalid with 0 bytes. I am using our latest version/fix: Aspose.Cells for Java
v8.3.1.2 (https://forum.aspose.com/t/66089):


e.g


Sample code:



Workbook workbook = new Workbook(“f:\files\sample.xlsx”);


Worksheet sheet = workbook.getWorksheets().get(0);


ImageOrPrintOptions options = new ImageOrPrintOptions();


options.setSaveFormat(SaveFormat.SVG);


SheetRender sr = new SheetRender(sheet, options);


sr.toImage(0, “f:/files/outsample1.svg”);

I have logged a ticket with an id “CELLSJAVA-41163” for your issue. We will look into it soon.

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

Thank you.

Hi,

Thanks for using Aspose.Cells for Java.

We have fixed this issue (i.e the problem of the svg can not pass svg validation).

Please download and try this fix: Aspose.Cells for Java v8.3.1.5 and let us know your feedback.

Hi,


I can confirm the issue is fixed in 8.3.1.5.
Thank you for the fast turnaround time!

Kind regards,
Taras

Hi Taras,


Thank you for the confirmation. Please feel free to contact us back in case you need our further assistance with Aspose APIs.

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


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