Editor for WinForms | ComponentOne
C1.Win.C1Editor.4.5.2 Assembly / C1.Win.C1Editor Namespace / C1TextRange Class / Normalize Method
Example

In This Topic
    Normalize Method
    In This Topic
    Moves the range pointers to the most inner text.
    Syntax
    'Declaration
     
    Public Sub Normalize() 
    public void Normalize()
    Remarks
    Different ranges can point to one and the same text, but to different XML tags. For example we have three XML-fragments: <p>text|<strong><em>inner text</em></strong>|text</p>, <p>text<strong>|<em>inner text</em>|</strong>text</p>, and <p>text<strong><em>|inner text|</em></strong>text</p> In all three fragments the ranges point to one and the same text "inner text", but they have different XML-ranges. The Normalize method transforms the first two ranges to the third one; it moves pointers inside (into the most inner tag). So, this method is necessary for a user to be sure that he works with a range positioned only on the text but not somewhere between elements in a document.
    Example
    The following example replaces the selected text with a new value.
    C1TextRange range = _editor.Selection.Clone();
    range.Text = value;
    //after inserting text we must collapse selection to the end
    range.Normalize();
    range.Start.MoveTo(range.End);
    range.Select();
    See Also