Unplanned
Last Updated: 31 Oct 2018 08:13 by ADMIN
ADMIN
Mihail
Created on: 07 Jun 2016 10:40
Category: RichTextBox
Type: Bug Report
0
RichTextBox: "a:link" CSS style is applied over a bookmark on HTML import
Importing HTML with "a:link" CSS style will be applied to the text in a bookmark. Here is example of such HTML:

<html>
  <head>
    <style type="text/css">
      a:link {
        text-decoration: underline;
      }
    </style>
  </head>
  <body>
    <a name="anchor">Anchor element</a>
  </body>
</html>

A possible workaround is to select the content between the bookmarks and apply different underline decoration. Here is example of how this could be done:

List<BookmarkRangeStart> bookmarks = document.EnumerateChildrenOfType<BookmarkRangeStart>().ToList();
foreach (var rangeStart in bookmarks)
{
    document.Selection.Clear();

    var start = new DocumentPosition(document);
    start.MoveToEndOfDocumentElement(rangeStart);

    var end = new DocumentPosition(document);
    end.MoveToEndOfDocumentElement(rangeStart.End);

    document.Selection.AddSelectionStart(start);
    document.Selection.AddSelectionEnd(end);

    RadDocumentEditor editor = new RadDocumentEditor(document);
    editor.ChangeUnderlineDecoration(UI.TextDecorations.DecorationProviders.UnderlineTypes.None);
}

document.Selection.Clear();
0 comments