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

Free Support Forum - aspose.com

How to add text and remove text from Shapes

Hi Team,
How to add text and remove text in the shapes.
Ex: There is rectangle shape, I need to add text and remove text from that shape using Aspose word Java.

Please share sample code.

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

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.insertShape(ShapeType.TEXT_BOX, 400, 200);

Paragraph p = new Paragraph(doc);
builder.write("Text inside Shape");


To remove text from that shape, please remove the Paragraph with text from the Shape: