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.
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.
@csaspose,
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);
shape.appendChild(p);
builder.moveTo(p);
builder.write("Text inside Shape");
doc.save("C:\\Temp\\output.docx");
To remove text from that shape, please remove the Paragraph with text from the Shape:
shape.removeChild(p);