Extract Chart Objects in Aspose.Word FOR JAVA

Hi all,

I need the functionality to extract chart object as image from the word document using Java.

Attached sample file with chart embedded in it.

Many thanks in advance

Priya dharshini J P

Hi Priya,


Thanks for your inquiry. Please use following code example to convert chart’s object into image.

<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>Document doc = new Document(MyDir + “Sample_Chart.docx”);

Shape shape = (Shape)doc.getChild(NodeType.SHAPE, 0, true);
if(shape.hasChart())
{
ShapeRenderer r = shape.getShapeRenderer();

ImageSaveOptions imageOptions = new ImageSaveOptions(SaveFormat.PNG);
r.save(MyDir + “17.5.png”, imageOptions);
}

Hi Tahir,

The exact issue we’re facing is the embedded chart object in the word document doesn’t produce proper output PDF.

Kind regards,
Jaiganesh
Hi Jaiganesh,

Thanks for your inquiry. We have tested the scenario and managed to reproduce the following issues at our side. For the sake of correction, we have logged these problems in our issue tracking system as follow:

WORDSJAVA-1592 : Chart's X-Axis is not rendered correctly in output PDF
WORDSJAVA-1593 : Chart's plot area is not rendered correctly in output PDF

You will be notified via this forum thread once these issues are resolved. We apologize for your inconvenience.

@priyadharshini,

The issues you have found earlier (filed as WORDSJAVA-1592 and WORDSJAVA-1593) have been fixed in this Aspose.Words for .NET 17.8 update and this Aspose.Words for Java 17.8 update.