Forums     Knowledge Base     OfficeWriter Online     
 
 
This documentation is for
OfficeWriter v3.8.1
.NET Platform

View Docs for Another
Version or Platform

Programmer's Reference > WordApplication API > Position

The Position Object


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 a Element.

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:

[csharp]
WordApplication app = new WordApplication();
Document doc = app.Create();
Position pos = doc.GetPosition(0);
[vbnet]
Dim app As New WordApplication()
Dim doc As Document = app.Create()
Dim pos As Position = doc.GetPosition(0)


Position Properties

Property Type Access Description
Position int read

Returns an int that represents the absolute position in the document



Position Methods

ReturnsSignature and Description
Hyperlink InsertHyperlink ( String url , String display )

Creates and returns a Hyperlink at this Position

InlineImage InsertImage ( String fileName )

Inserts and returns an InlineImage at the point represented by this Position

InlineImage InsertImage ( System.IO.Stream stream )

Inserts and returns an InlineImage at the point represented by this Position

List InsertList ( boolean numbered )

Creates and returns an empty List at the point represented by this Position

MergeField InsertMergeField ( String fieldName , String display )

Creates and returns a MergeField at this Position

Paragraph InsertParagraph ( NamedStyle style )

Creates and returns an empty Paragraph at the point represented by this Position, formatted with the specified style

Section InsertSection ( )

Creates and returns an empty Section at the point represented by this Position

Table InsertTable ( int rows , int columns )

Creates and returns a Table at the point represented by this Position

CharacterRun InsertText ( String text , boolean newRun )

Creates and returns a CharacterRun at the point represented by this Position



Copyright 2007 © SoftArtisans, Inc. All Rights Reserved.