The C1RichTextBox.Html property is used to assign and retrieve formatted text as HTML. When the Html property is set, the Html document is converted to a C1Document that, when displayed, resembles the Html content as much as possible. The original structure and styles are not kept.
When the Html property is read, or exported, an Html document is generated from the current C1Document. There are two ways that html can be generated, with a stylesheet or with inline styles. You can use the GetHtml method, passing HtmlEncoding.Inline as the second parameter, to generate Html with inline style.
The HTML text needs to be encoded in the XAML file, so, for example, instead of <b> for bold, tags are encoded as <b>;.
At Design Time
To set the C1RichTextBox.Html property, complete the following steps:
This will set the C1RichTextBox.Html property to the value you chose.
In XAML
For example, to set the C1RichTextBox.Html property add Html="Hello World!" to the <c1rtb:C1RichTextBox> tag so that it appears similar to the following:
XAML Markup |
Copy Code
|
---|---|
<c1rtb:C1RichTextBox HorizontalAlignment="Left" Margin="10,10,0,0" Name="C1RichTextBox1" VerticalAlignment="Top" Height="83" Width="208" Html="<h1>Hello World!</h1>" /> |
In Code
For example, to set the C1RichTextBox.Html property add the following code to your project:
Visual Basic |
Copy Code
|
---|---|
Me.C1RichTextBox1.Html = "<b>Hello World!</b>" |
C# |
Copy Code
|
---|---|
this.c1RichTextBox1.Html = "<b>Hello World!</b>" |