[]
        
(Showing Draft Content)

Editing Documents

C1Editor supports editing complete XHTML documents and individual document fragments. This section describes operations for retrieving, replacing, removing, formatting, and inserting document content.


Retrieve Text

Retrieve unformatted text from a document using the GetText method of the C1Editor class, as shown in the following code example.

Use the GetText method of the C1Editor class to retrieve the unformatted text contained in the document.

var text = c1Editor1.GetText();
MessageBox.Show(text);

Replace an Element

Use the ReplaceElement method of the C1Editor class to replace the content of a specific document element.

The method accepts the replacement content and the ID of the HTML fragment to replace. For example, an element with the ID head can be replaced with updated heading content.

c1Editor1.ReplaceElement(" <h1 id=\"head\">About Nikola Tesla</h1>", "head");

Delete Specific Element

Use the RemoveElement method of the C1Editor class to remove a document element.

The method can identify elements by ID, tag name, or class name.

The following example removes the element with Id "P1".

c1Editor1.RemoveElement("P1");