Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Wiki Markup
{description}
{excerpt}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|Position] object can be obtained from an [Element|Element].{excerpt}
{signature:C#}
 public sealed class Position
{signature}{signature:vb.net}
Public NotInheritable Class Position
{signature}
{remarks}You cannot create a new {{Position}} object using the {{new}} keyword. You must get a {{Position}} object using the [GetPosition()|Element.GetPosition(Int32)] method of the {{Element}} class \(or the [Document|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}}.

{remarks}
{example}{code:csharp|title=C#}

          WordApplication app = new WordApplication();
          Document doc = app.Create();
          Position pos = doc.GetPosition(0);
        {code}
{code:vb.net|title=vb.net}

          Dim app As New WordApplication()
          Dim doc As Document = app.Create()
          Dim pos As Position = doc.GetPosition(0)
        {code}

{example}
{properties}
||Name||Description||
|[PositionValue|Position.PositionValue]|{excerpt-include:Position.PositionValue|nopanel=true}|
{methods}
||Name||Description||
|[InsertHyperlink(String, String)|Position.InsertHyperlink(String, String)]|{excerpt-include:Position.InsertHyperlink(String, String)|nopanel=true}|
|[InsertImage(String)|Position.InsertImage(String)]|{excerpt-include:Position.InsertImage(String)|nopanel=true}|
|[InsertImage(System.IO.Stream)|Position.InsertImage(System.IO.Stream)]|{excerpt-include:Position.InsertImage(System.IO.Stream)|nopanel=true}|
|[InsertList(Boolean)|Position.InsertList(Boolean)]|{excerpt-include:Position.InsertList(Boolean)|nopanel=true}|
|[InsertMergeField(String, String)|Position.InsertMergeField(String, String)]|{excerpt-include:Position.InsertMergeField(String, String)|nopanel=true}|
|[InsertParagraph(NamedStyle)|Position.InsertParagraph(NamedStyle)]|{excerpt-include:Position.InsertParagraph(NamedStyle)|nopanel=true}|
|[InsertSection()|Position.InsertSection()]|{excerpt-include:Position.InsertSection()|nopanel=true}|
|[InsertTable(Int32, Int32)|Position.InsertTable(Int32, Int32)]|{excerpt-include:Position.InsertTable(Int32, Int32)|nopanel=true}|
|[InsertText(String, Boolean)|Position.InsertText(String, Boolean)]|{excerpt-include:Position.InsertText(String, Boolean)|nopanel=true}|