How to Insert a TextBox in Word Document using Aspose.Words (.Net)

How to Insert a TextBox in Word Document using Aspose.Words (.Net)?
Please find attached snapshot for more information.
Thanks
Jagadish

Hi
Thanks for your request. First of all you should create TextBox, then insert needed content inside this TextBox and then add this textbox to the document. Your code should look like the following:

// Create or open document.
Document doc = new Document();
// Create textbox shape.
Shape textbox = new Shape(doc, ShapeType.TextBox);
textbox.Width = 300;
textbox.Height = 300;
Paragraph paragraph = new Paragraph(doc);
paragraph.AppendChild(new Run(doc, "Test"));
// Insert paragraph into the textbox.
textbox.AppendChild(paragraph);
// Insert textbox into the document.
doc.FirstSection.Body.FirstParagraph.AppendChild(textbox);
doc.Save("C:\\Temp\\out.doc");

Hope this helps.
Best regards.

Hi,

I am using Aspose.words.dll (Version 10.5.0.0), But couldnt find the

Shape Class. Is there anything else that i should be referencing/using

Thanks

Hi
Thanks for your request. Shape class is in Aspose.Words.Drawing namespace:
https://reference.aspose.com/words/net/aspose.words.drawing/shape/
You should simply add:

using Aspose.Words.Drawing;

Best regards,