Editor for WinForms | ComponentOne
C1.Win.C1Editor.4.8 Assembly / C1.Win.C1Editor Namespace / C1TextRange Class / Text Property
Example

In This Topic
    Text Property (C1TextRange)
    In This Topic
    Returns or sets the inner text of the text range.
    Syntax
    'Declaration
     
    Public Property Text As System.String
    public System.string Text {get; set;}
    Example
    This code demonstrates the Text and the XmlText properties.
    private void button1_Click(object sender, EventArgs e)
    {
        c1Editor1.LoadXml("<html><head><title>Document</title></head><body><p>12<span>3</span>456</p></body></html>", new Uri("c:\\"));
        C1TextRange r = c1Editor1.CreateRange();
        r.Move(1, 3);
        Console.WriteLine(r.Text);
        // Output: 234
        Console.WriteLine(r.XmlText);
        // Output: <p xmlns="http://www.w3.org/1999/xhtml">2<span>3</span>4</p>
        r.XmlText = "<div style=\"border: solid 1px black\">New Text</div>";
        Console.WriteLine(c1Editor1.Text);
        //Output:
        //1
        //NewText
        //56
    }
    See Also