Get all Textboxes from Document (Shape? Rectangle?)

Hey folks,

I have a Document with Textfields in it and i want to erase them. But how do i access the Textfields? Are they Shapes? Rectangles? Some of them do contain an image. Does that matter? Do i have have to erase the Images out of the Textbox first and erase the textbox itself after?

Hope i can find any help


Thanks for your request. In this case, please try using the following code:

Document doc = new Document("Test.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 text box

Hope this helps.
Best regards,