Page tree
Skip to end of metadata
Go to start of metadata

Description

This class is used to represent a cursor position in the document. It sits between two characters and its position is represented as the index of the character it sits behind. A Position object can be obtained from an Element.

C#
vb.net

Remarks

You cannot create a new Position object using the new keyword. You must get a Position object using the GetPosition() method of the Element class (or the Document class, which inherits from Element ). This method takes a parameter that represents the relative offset from the start of this Element to point at which to get the Position.

The following sample gets a Position object from the start of a Document.

Examples

C#
vb.net

Properties

Name

Description

PositionValue

Returns an int that represents the absolute position in the document.

Methods

Name

Description

InsertHyperlink(String, String)

Creates and returns a Hyperlink at this Position. This hyperlink will have the specified url and displayed text.

InsertImage(String)

Inserts and returns an InlineImage at the point represented by this Position. The image that is inserted is specified by a fileName string.

InsertImage(System.IO.Stream)

Inserts and returns an InlineImage at the point represented by this Position. The image that is inserted is specified by a Stream object.

InsertList(Boolean)

Creates and returns an empty List at the point represented by this Position. By passing a boolean, it can be a numbered list (true) or a bulleted list (false).

InsertMergeField(String, String)

Creates and returns a MergeField at this Position. This merge field will have the specified name and contents.

InsertParagraph(NamedStyle)

Creates and returns an empty Paragraph at the point represented by this Position, formatted with the specified style. If this Position is in the middle of a paragraph the containing paragraph will be split.

InsertSection()

Creates and returns an empty Section at the point represented by this Position. If this Position is in the middle of a section then the containing section will be split.

InsertTable(Int32, Int32)

Creates and returns a Table at the point represented by this Position. The table will contain the specified number of rows and columns.

InsertText(String, Boolean)

Creates and returns a CharacterRun at the point represented by this Position. The text to be inserted is specified as well as whether this should be a new character run or part of the previous one.
  • No labels