We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Fill a Text Box Shape in Word Document with an Image using Java | Set Textbox Image

LINQ Reporting Engine fit my requirement ,but it take long time.i just to use functionality of Inserting Images Dynamically,i can’t stand time it take.whether i can implement this functionality by using api.
thanks advance

@liu9527,

Please see these input and output Word documents (Fill Textbox with image.zip (25.3 KB)) and try running the following code that will fill a Textbox in Word document with an Image:

Document doc = new Document("E:\\Temp\\textbox.docx");
for (Shape shape : (Iterable<Shape>) doc.getChildNodes(NodeType.SHAPE, true)) {
    if (shape.getShapeType() == ShapeType.TEXT_BOX) {
        if (shape.canHaveImage())
            shape.getImageData().setImage("E:\\Temp\\Aspose.Words.png");
        break;
    }
}
doc.save("E:\\Temp\\aw20.6.docx");

Please ZIP and attach the following resources here for testing:

  • Your simplified template Word document
  • A sample image file
  • Please also create a standalone simple Java application (source code without compilation errors) that helps us to reproduce this performance issue on our end and attach it here for testing. Please do not include Aspose.Words JAR files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start investigation into your scenario and provide you more information.