Free Support Forum - aspose.com

Working with TextBoxes

Is it possible to insert a new textbox into a Word document using Aspose.Words 3.5.1? If not, is it possible to position, remove and/or add text to an existing text box in a Word document? If either of these is possible, could I please see some sample code or at least a list of the methods/objects I would use to work with TextBoxes.

Thanks.

Textbox is represented by a Shape class. At the moment a new Shape cannot be created programmatically, but existing shapes can be removed or manipulated via the available properties.

Check the API reference for Shape class to find more information.

Thanks. I figured out how to loop through the shapes and work with those properties. How could I now position a textbox based on the location of a bookmark or other element within a main text block? For instance, at a selected bookmark within the document, I want a textbox to vertically align with the bookmark. Is that possible? I assuming BookMarks really don’t have an exact position. Is there anyway to determine a BookMark’s position using the Viewer class and then apply that position to the textbox?

I am afraid that is not possible using current version of Aspose.Words. Features like this require pagination engine, we work on it but it will not be available for another 2-3 months.