This is a migrated thread and some comments may be shown as answers.

Insert HTML into document

1 Answer 461 Views
WordsProcessing
This is a migrated thread and some comments may be shown as answers.
Cleanwatts
Top achievements
Rank 1
Cleanwatts asked on 21 Apr 2016, 11:26 AM

Hello,

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();
editor.MoveToParagraphStart(paragraph);
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>
<ul>
    <li>Sed aliquet <strong>nibh</strong> vitae ligula vestibulum.</li>
    <li>Iid ullamcorper dolor sollicitudin.</li>
</ul>
<p>Nunc volutpat dui dui, <em>eget laoreet est sollicitudin at</em>. Curabitur mi ipsum, feugiat nec tortor a, tristique elementum purus.</p>
<ol>
    <li>Duis <em>nec</em> dignissim nunc.</li>
    <li>Aenean dui arcu.</li>
    <li>Vulputate eget leo ac.</li>
</ol>
<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.

 

1 Answer, 1 is accepted

Sort by
0
Mihail
Telerik team
answered on 25 Apr 2016, 10:55 AM
Hello,

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

Regards,
Mihail
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
WordsProcessing
Asked by
Cleanwatts
Top achievements
Rank 1
Answers by
Mihail
Telerik team
Share this question
or