Editor provides options to specify the styling and appearance for the XHTML document and its elements based on the requirements using Styles option in the EditorRibbon.
Editor allows you to highlight text in the document through FindAndDecorateAsync method of the C1Editor class. This method, applies the specified style to all occurrences of the matching string. The FindAndDecorateAsync method accepts a pattern string and style attributes as parameters. The pattern string can be a normal text or a regular expression used to match the text in the document. The style attributes can be background color, foreground color etc. which have to be separated using semicolon (;).
Following code applies 'Blue' as background color and 'Beige' as foreground color to all the occurrences of "Nikola".
C# |
Copy Code |
---|---|
c1Editor1.FindAndDecorateAsync("Nikola", null, "background-color:blue; color:beige;"); |
You can apply preset styles available in Styles ribbon group to a selected text in the document. Additionally, you can create and save custom styles through Create New Style from Formatting option available under the Styles ribbon group. The image below shows Styles preset options available in EditorRibbon. Also, the custom styles can be removed using the Clear All Formatting option available in the Styles ribbon group.