HTML5 Web Editor - Programming API

Web.TextControl provides the same interface to the TextParts such as the ServerTextControl. You can iterate through all TextParts including the MainText, TextFrames and HeaderFooter objects. These TextPart objects provide a Selection object that can be used to get and set formatted text and to interact with the content.

A temporary ServerTextControl is used to modify the content of Web.TextControl. The Selection is loaded into a ServerTextControl, modified and loaded back to Web.TextControl.


The advantage of using a temporary ServerTextControl is the compatibility of existing code written for ServerTextControl. You can reuse all of your existing procedures to modify documents.


protected void Button1_Click(object sender, EventArgs e)
    // insert a new text field into Web.TextControl
    using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())

        MergeField newField = new MergeField();
        newField.Name = TextBox2.Text;
        newField.Text = "Text Field: " + TextBox2.Text; ;


        byte[] data;
        tx.Save(out data, TXTextControl.BinaryStreamType.InternalUnicodeFormat);
        TextControl1.Selection.Load(data, TXTextControl.Web.BinaryStreamType.InternalUnicodeFormat);

        TextBox2.Text = "";

HTML5 Web editor