Hi Eric,
Thanks for your request. In this case, please try using the following code:
Document doc = new Document("Customer+Advisory.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
// Get all shapes in the document.
NodeCollection shapesColl = doc.GetChildNodes(NodeType.Shape, true, false);
// Loop through all shapes.
foreach(Shape shape in shapesColl)
{
if (shape.ShapeType == ShapeType.TextBox)
{
// Remove old text
shape.RemoveAllChildren();
// Add new paragraph
shape.AppendChild(new Paragraph(doc));
builder.MoveTo(shape.FirstParagraph);
// Insert Text
builder.Write("This is text inside textbox");
}
}
doc.Save("out.docx");
Hope this helps.
Best regards,