[]
        
(Showing Draft Content)

C1.Win.C1Editor.C1TextRange.Normalize

Normalize Method

Normalize()

Moves the range pointers to the most inner text.

Declaration
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.

Examples

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();