Insert HTML into document

2 posts, 0 answers
  1. VPS
    VPS avatar
    16 posts
    Member since:
    Jan 2015

    Posted 21 Apr 2016 Link to this post


    I have a situation where a user can create some text using Kendo UI Editor that later gets inserted into a document. All goes well except if the HTML contains a list (bullet or numbered) where one or more of the list item has some kind of character formatting (bold, italic, font color,...). In the resulting document, the formatted text is placed in a new paragraph, inside the list.

    The code I use to insert the HTML text into the document is:

    var paragraph = section.Blocks.AddParagraph();
    HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
    RadFlowDocument htmlDocument = htmlProvider.Import(htmlText);
    var insertOptions = new InsertDocumentOptions
        ConflictingStylesResolutionMode = ConflictingStylesResolutionMode.UseTargetStyle
    editor.InsertDocument(htmlDocument, insertOptions);

    The HTML used is:

    <p>Lorem ipsum dolor sit amet, <strong>consectetur</strong> adipiscing elit. Aenean viverra augue nec consectetur porta.</p>
        <li>Sed aliquet <strong>nibh</strong> vitae ligula vestibulum.</li>
        <li>Iid ullamcorper dolor sollicitudin.</li>
    <p>Nunc volutpat dui dui, <em>eget laoreet est sollicitudin at</em>. Curabitur mi ipsum, feugiat nec tortor a, tristique elementum purus.</p>
        <li>Duis <em>nec</em> dignissim nunc.</li>
        <li>Aenean dui arcu.</li>
        <li>Vulputate eget leo ac.</li>
    <p>Volutpat volutpat lorem. Vivamus luctus lorem et iaculis porttitor.</p>

    The attached images show the text being edited and the result after being exported into a document.


  2. Mihail
    Mihail avatar
    223 posts

    Posted 25 Apr 2016 Link to this post


    I can confirm that there is a problem. I have logged new bug report item into our feedback portal. Here is a link if you would like to subscribe for status changes: Styled text in list is imported as different paragraph from HTML document

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top