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

Free Support Forum - aspose.com

Insert Text into Shape in Word Document using Java | Add Paragraph Text Content inside Text Box Shape

How can I set text into the shape?
I go into the shape with using builder.moveTo(shape) and write the text using builder.writeln(‘text’) but text write above this shape. Shape’s lastParagraph is null.


Please add a Paragraph inside Shape, move cursor to that Paragraph and then write text. Here is sample Java code:

Document document = new Document("E:\\Temp\\input.docx");
DocumentBuilder builder = new DocumentBuilder(document);

Shape shape = new Shape(document, ShapeType.TEXT_BOX);
shape.setWidth(72 * 2);
shape.setHeight(72 * 2);

Paragraph para = new Paragraph(document);


builder.write("Inside Shape");

1 Like


That’s work!
Thank you!