Can i get the above code in java?
Thanks…
Please check the following Aspose.Words for Java code:
Document doc = new Document("Test1.docx");
Shape shape = (Shape)doc.getChildNodes(NodeType.SHAPE, true).get(0);
if (shape.hasChart())
{
ShapeRenderer renderer = shape.getShapeRenderer();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
{
renderer.save(baos, new ImageSaveOptions(SaveFormat.PNG));
DocumentBuilder builder = new DocumentBuilder(doc);
builder.moveTo(shape);
builder.insertImage(baos.toByteArray());
shape.remove();
}
}
doc.save("18.1.pdf");
Hope, this helps.