Unplanned
Last Updated: 09 Feb 2023 11:00 by Amit
Amit
Created on: 09 Feb 2023 11:00
Category: WordsProcessing
Type: Bug Report
0
WordsProcessing: HtmlFormatProvider: When a span has nested strikethrough and underline tags applied to it only the inner tag is respected

When a span has nested strikethrough and underline tags applied to it only the inner tag is respected.

This HTML:

<u><del>UnderlineStrikethrough</del></u>

results in:

UnderlineStrikethrough

And this HTML:

<del><u>UnderlineStrikethrough</u></del>

results in:

UnderlineStrikethrough

 

As a possible workaround, you can add some text placeholder to the span that needs both "underline" and "strikethrough" and after import set the properties, and remove the placeholder text.

Sample HTML:

<u><del>##PlaceholderStart##UnderlineStrikethrough##PlaceholderEnd##</del></u>

after import, execute this:

const string PlaceholderTextStart = "##PlaceholderStart##";
const string PlaceholderTextEnd = "##PlaceholderEnd##";
RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document);
Regex regex = new Regex(PlaceholderTextStart + "[a-zA-Z]*" + PlaceholderTextEnd);
var results = editor.FindAll(regex);
foreach (var result in results)
{
    foreach (var run in result.Runs)
    {
        run.Properties.Strikethrough.LocalValue = true;
        run.Properties.UnderlinePattern.LocalValue = Telerik.Windows.Documents.Flow.Model.Styles.UnderlinePattern.Single;
        run.Text = run.Text.Replace(PlaceholderTextStart, string.Empty);
        run.Text = run.Text.Replace(PlaceholderTextEnd, string.Empty);
    }
}

 

0 comments