Editor for WinForms | ComponentOne
C1.Win.C1Editor.4.8 Assembly / C1.Win.C1Editor Namespace / C1TextRange Class / SetXmlElement Method
An XmlElement to replace the range content.
Example

In This Topic
    SetXmlElement Method
    In This Topic
    Replaces the text range content with the given element of System.Xml.XmlElement type.
    Syntax
    'Declaration
     
    Public Sub SetXmlElement( _
       ByVal element As System.Xml.XmlElement _
    ) 
    public void SetXmlElement( 
       System.Xml.XmlElement element
    )

    Parameters

    element
    An XmlElement to replace the range content.
    Example
    The example replaces selected text with a div XmlElement.
    private void button1_Click(object sender, EventArgs e)
    {
       XmlElement node = c1Editor1.Document.CreateElement("div");
       node.InnerText = "New Element";
       c1Editor1.Selection.SetXmlElement(node);
    }
    See Also