Unplanned
Last Updated: 29 Aug 2022 12:53 by Prashant
Prashant
Created on: 29 Aug 2022 12:53
Category: RichTextEditor
Type: Bug Report
0
RadRichTextEditor: HtmlFormatProvider: Font family and font size are locally set to Times New Roman and 12 to span elements during import

When a document is imported from HTML, we set locally to the span elements Times New Roman nevertheless it is not declared anywhere. This breaks the document view if for example we decide to change the RadDocument's default font family or even the NormalWeb style's font. The same applies for the font size as well.

Workaround: Clear the FontFamily property after import

foreach (Span span in this.radRichTextBox.Document.EnumerateChildrenOfType<Span>())
{
    span.GetStyleProperty(Span.FontFamilyProperty).ClearValue();

   span.GetStyleProperty(Span.FontSizeProperty).ClearValue();

}

Steps to reproduce:

1. Import the following html:

this.radRichTextBox.Document = new HtmlFormatProvider().Import(@"<h1>Hello</h1><h2>World</h2><p>Lorem ipsum<p>");

2. Set the document's default font family to Comic Sans MS:

this.radRichTextBox.Document.Style.SpanProperties.FontFamily = new FontFamily("Comic Sans MS");

Observe: The font in the document is Times New Roman

Expected: The font should be Comic Sans MS

0 comments