We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Words Textbox object

Hi,



We are using Aspose.Words Textbox object to render text. As this control has left and top properties which use can set to decide the position of the control on the document.



If user provides the input for a textbox object as follows,



textbox.left = 50;

textbox.top = 100;

for a A4 size page setting.



How could we measure the accuracy of the left and top properties after the document is rendered using above inputs.



I mean how could we check that the assigned values are taken and used by Aspose.Words appropriately.



Please clarify.





Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. You can open the generated document using MS Word, right click on the textbox, select “Format Text Box”, select “Layout” tab and click “Advanced” button. In the shown form you can see position of the shape. Here is code I used for testing:

Document doc = new Document();

Shape textbox = new Shape(doc, ShapeType.TextBox);

Paragraph par = new Paragraph(doc);

par.AppendChild(new Run(doc, "test"));

textbox.AppendChild(par);

textbox.Width = 100;

textbox.Height = 100;

textbox.Left = 50;

textbox.Top = 100;

doc.FirstSection.Body.FirstParagraph.AppendChild(textbox);

doc.Save(@"Test134\out.doc");

Best regards.