Hello,
Is there an equivalent in Aspose.Words of MS Word’s Range.get_information(WdInformation.wdHorizontalPositionRelatvieToPage) method? Basically, I’d like to get the horizontal position relative to the page of every first character of every paragraph (after loading an existing word document in Aspose). How in Aspose can I get that information? TIA,
Thanks for your inquiry. You can iterate through the Paragraph collection and obtain top, left position of every Paragraph using Aspose.Words.Layout API. For example, you can use the following code to obtain the rectangle associated with last Paragraph in document:
Document doc = new Document(@"C:\Temp\in.docx");
LayoutCollector collector = new LayoutCollector(doc);
LayoutEnumerator enumerator = new LayoutEnumerator(doc);
enumerator.Current = collector.GetEntity(doc.FirstSection.Body.LastParagraph);
RectangleF rect = enumerator.Rectangle;