Thanks for your inquiry. First of all, please note that Aspose.Words is quite
different from the Microsoft Word’s Object Model in that it represents
the document as a tree of objects more like an XML DOM tree. If
you worked with any XML DOM library you will find it is easy to
understand and work with Aspose.Words. When you load a Word document
into Aspose.Words, it builds its DOM and all document elements and
formatting are simply loaded into memory. Please read the following
articles for more information on DOM:
- Node Position of the pointed arrow?*
Please note that MS Word document is flow document and does not contain any information about its layout into lines and pages. Therefore, technically there is no “Page” concept in Word document. Pages are created by Microsoft Word on the fly.
Aspose.Words uses our own Rendering Engine to layout documents into pages. The Aspose.Words.Layout namespace provides classes that allow to access information such as on what page and where on a page particular document elements are positioned, when the document is formatted into pages. Please read about LayoutCollector and LayoutEnumerator from here:
Please use the following code example to get the position of CommentRangeStart node.
Document doc = new Document(MyDir + "in.docx");
LayoutCollector layoutCollector = new LayoutCollector(doc);
LayoutEnumerator layoutEnumerator = new LayoutEnumerator(doc);
var collection = doc.GetChildNodes(NodeType.CommentRangeStart, true);
foreach (CommentRangeStart cStart in collection)
var renderObject = layoutCollector.GetEntity(cStart);
layoutEnumerator.Current = renderObject;
RectangleF location = layoutEnumerator.Rectangle;
- The value of “this text selected”*
The Comment class represents a container for text of a comment. A comment is an annotation which is anchored to a region of text or to a position in text. A comment can contain an arbitrary amount of block-level content.
If a Comment object occurs on its own, the comment is anchored to the position of the Comment object.
To anchor a comment to a region of text three objects are required: Comment, CommentRangeStart and CommentRangeEnd. All three objects need to share the same Id value.
Please read the Run nodes between CommentRangeStart and CommentRangeEnd and get the text using Run.Text property.
- And I able to create image on top of “this text selected”*
Please get the position of CommentRangeStart node using the code above and insert the image using DocumentBuilder.InsertImage Method (String).