Borders around an image

How do I put borders around an image?
Code example would be useful
Thanks

You can put the image in a table and have the table borders with a thickness.You can use the following code.

Document doc = null;
try
{
    doc = new Document("C:/SurveyDocs/graph.docx");
}
catch (final Exception e1)
{
    // TODO Auto-generated catch block
    e1.printStackTrace();
}

final DocumentBuilder builder = new DocumentBuilder(doc);
builder.getPageSetup().setOrientation(Orientation.LANDSCAPE);
builder.getPageSetup().setLeftMargin(30);
builder.getPageSetup().setRightMargin(30);
builder.getPageSetup().setTopMargin(30);
builder.getPageSetup().setBottomMargin(40);

builder.writeln("Hi");
builder.startTable();
builder.insertCell();
rowFormat.setHeight(20);
rowFormat.setHeightRule(HeightRule.EXACTLY);
builder.getCellFormat().setWidth(920);
builder.getCellFormat().getShading().setBackgroundPatternColor(Color.GRAY);
builder.getCellFormat().getBorders().getBottom().setLineWidth(2.0);
builder.getCellFormat().getBorders().getRight().setLineWidth(2.0)

try
{
    builder.insertImage("C:/abc.png", 100, 100);
}
catch (final Exception e2)
{
    // TODO Auto-generated catch block
    e2.printStackTrace();
}
builder.endRow();
builder.endtable();

Hi there,

Thanks for your inquiry. In your case, I suggest you please use the Font.Border property as shown below to set border around characters/shape(inline).

Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.getFont().clearFormatting();
builder.getFont().getBorder().setLineStyle(LineStyle.THICK);
builder.getFont().getBorder().setLineWidth(2);
Shape shape = builder.insertImage("http://www.aspose.com/images/aspose-logo.gif");
builder.getFont().clearFormatting();
builder.writeln();
builder.writeln();
builder.writeln("Some Text");
doc.save(MyDir + "Out.docx");