RichTextBox for UWP | ComponentOne
Working with RichTextBox for UWP / Setting and Formatting Content / Saving and Loading HTML
In This Topic
    Saving and Loading HTML
    In This Topic

    To preserve the formatting of your C1RichTextBox control while persisting the contents of the control, use the C1RichTextBox.Html property.

    The C1RichTextBox.Html property gets or sets the formatted content of a C1RichTextBox as an HTML string. The HTML filter built into the C1RichTextBox is fairly rich. It supports CSS styles, images, hyperlinks, lists, and so on. But the filter does not support all HTML; it is limited to features supported by the C1RichTextBox control itself. For example, the current version of C1RichTextBox does not support tables. Still, you can use the C1RichTextBox.Html property to display simple HTML documents.

    If you type "Hello world." into a C1RichTextBox, the C1RichTextBox.Html property will return the following markup:

    XAML Markup
    Copy Code
    <html>
    <head>
      <style type="text/css">
        .c0 { font-family:Portable User Interface;font-size:9pt; }
        .c1 { margin-bottom:7.5pt; }
      </style>
    </head>
    <body class="c0">
    <p class="c1">Hello world.</p>
    </body>
    </html>
    

    Note that the C1RichTextBox.Html property is just a filter between HTML and the internal C1Document class. Any information in the HTML stream that is not supported by the C1RichTextBox (for example, comments and meta information) is discarded, and will not be preserved when you save the HTML document later.