We are seeing an issue where a SVG-based 3D Pie Chart renders incorrectly when imported into a Word Document. Given the attached
3D_pie_chart.html file (which contains the embedded SVG image):
- When imported into a Word document via Aspose Words, the Pie Chart shows incorrect shadows on some of the slices.
- When rendered in a Browser (Firefox, Edge, etc.), the Pie Chart is appears as expected.
This behavior can be seen in the latest Aspose Cells for Java version 20.11, the attached
3D_pie_chart.html file and the following Java code:
final String svgSrc = [PATH] + "3D_pie_chart.html"; // create a new Document and DocumentBuilder Document wdDoc = new Document(); DocumentBuilder builder = new DocumentBuilder(wdDoc); builder.moveToDocumentEnd(); // load and insert the SVG source into the doc String html = new String(Files.readAllBytes(Paths.get(svgSrc)), "UTF-8"); builder.insertHtml(html, false); final String newDoc = svgSrc.replace(".html", ".docx"); Files.deleteIfExists(Paths.get(newDoc)); wdDoc.save(newDoc); System.out.println("Saved Word Document: " + newDoc);
Running the above code should produce a new
3D_pie_chart.docx file similar to the one attached.
- Opening the
3D_pie_chart.htmlfile in a Browser (such as Firefox or Edge) - renders the Chart as expected.
- Opening the generated DOCX in MS Word shows the 3D Pie Chart having some of the slices with unwanted shading - in particular the slices for “USA” and “Italy” have unwanted shadows.
- Aspose Cells for Java 20.11
- Java version 1.8.0_211
- Windows 10 OS (but also reproducible under Linux).
File description from the
3D_pie_chart.zip (30.7 KB) attachment:
- 3D_pie_chart.html: Source HTML file containing an embedded SVG-based 3D Pie Chart and used by the code above.
- 3D_pie_chart.docx: DOCX file generated by the code above on our environment.
- 3D_pie_chart.png: PNG representation of the 3D Pie Chart - included as an example of the expected image.