Click or drag to resize
TextRangeClone Method
Gets a duplicate of this range object.

Namespace: TextObjectModel
Assembly: ManagedTOM2 (in ManagedTOM2.dll) Version: 1.0.5577.41188
Syntax
public TextRange Clone()

Return Value

Type: TextRange
The duplicate of the range.
Examples
The following example demonstrates how to duplicate a TextRange object:
C#
void CloneExample(TextRange range) {
    range.Text = "One Two";

    TextRange one = range.Clone();
    one.Length = 3;

    TextRange two = range.Clone();
    two.Start += 4;
    two.Length = 3;

    one.Text = "Three";
    two.Text = "Four";

    // range text is now "Three Four"
    Console.WriteLine("Result: {0}", range.Text);
}
See Also