Free Support Forum - aspose.com

Does Aspose Word support setting image border color- border style- border width and border margin?

Hi Support,

Does Aspose Word for Java support setting image border color, border style, border width and border margin? Please give an example code on how to do that?

Thanks.

Hello

Thanks for your request. Please see the following link to learn how to achieve what you need:

http://www.aspose.com/documentation/java-components/aspose.words-for-java/com/aspose/words/imagedata.html#Borders

Please try using the following code:

Document doc = new Document("C:\\Temp\\in.doc");

Node[] shapes = doc.getChildNodes(NodeType.SHAPE, true).toArray();

// Loop through all images

for(int i=0; i<shapes.length; i++)

{

Shape shape = (Shape)shapes[i];

if(shape.hasImage())

{

shape.getImageData().getBorders().setColor(Color.BLUE);

shape.getImageData().getBorders().setLineStyle(LineStyle.DOUBLE);

shape.getImageData().getBorders().setLineWidth(2);

}

}

doc.save("C:\\Temp\\out.doc");

Best regards,