Completed
Last Updated: 04 Feb 2020 14:49 by ADMIN
Release LIB 2020.1.210 (02/10/2020)
ADMIN
Deyan
Created on: 25 Apr 2016 16:47
Category: WordsProcessing
Type: Bug Report
0
WordsProcessing: Spaces after hyperlinks spans are trimmed when importing from HTML
When importing from HTML, all successive spaces in a spans are trimmed. Instead, in some cases one space should be left, e.g. between words. For example, the importing the following HTML should leave one space after the hyperlink:

<p><a href="www.telerik.com" target="_blank"><span>test</span></a>      and more.</p>

Workaround: After importing, check if the runs after the hyperlinks start with space:
foreach (var hyperlinkEnd in this.document.EnumerateChildrenOfType<FieldCharacter>().Where(f => f.FieldCharacterType == FieldCharacterType.End))
{
    Paragraph currentParagraph = hyperlinkEnd.Paragraph;
    int indexOfNextRun = currentParagraph.Inlines.IndexOf(hyperlinkEnd) + 1;
    if (currentParagraph.Inlines.Count > indexOfNextRun)
    {
        Run run = currentParagraph.Inlines[indexOfNextRun] as Run;
        if (run != null && run.Text[0] != ' ')
        {
            run.Text = " " + run.Text;
        }
    }
}
0 comments