Free Support Forum - aspose.com

Moving cursor to specific place in Aspose.Word

Dear All,

I am trying to move cursor to specific position by using Aspose.Word but I can not. For example, I want to move the cursor from the start of the document to right hand side 10 characters or down for 2 lines…
Can all of you give me a clue to deal with the thing?

Thanks you,

KSR

Character Position

A document in Aspose.Words is represented by a tree of nodes. There is no easy way to treat a document like a continuous sequence of text. Some operations are available that work like this (replace, or get/set text of a bookmark for example), but most of the operations work only with a tree of nodes.

You can have something like this:

Document

->Section

-->Body

--->Paragraph

---->Run (Text = "Hello", Font.Bold = true)

---->Run (Text = " World!", Font.Color = red)

The above objects are nodes in a tree. You can access them via parent/child/sibling properties and create/delete/modify. But there is no easy way to get access directly to 10th character position or so. See the Aspose.Words documentation for more info.

Line Position

There is no way to access lines in Aspose.Words. At least not yet. Lines are elements of document layout, not of document. Aspose.Words document represents content and formatting of a document, not its layout into pages. Therefore no access to pages or lines.