Hi Telerik forum,
I began to use the RichTextEditor to create programmatically a radDocument (so i use the paragraph, span, section object to create it).
Once the document is shown, users can insert formatted paragraph to personalize the document. The html text paragraph are stored in database in html format.
The thing i need is to be able to insert formatted html paragraph into this raddocument already generated.
My problem is to evaluate all the html text (with differents tags inside it, span, table, tr etc). I use the HtmlFormatProvider that works perfectly but it produce a new raddocument. So i tried to convert the htmlformatprovider document into a DocumentFragment, but i have to use fragment.EnumerateChildrenOfType(Of object) and explicitly specify the object type (what i wouldn't do).
What's the best approach to insert html text into an existing raddocument ?
Thanks for your help, hoping that my question is clear.
Here's my sample code :
Dim
document
As
New
RadDocument
Dim
section
As
New
Section
Dim
p9
As
New
Paragraph
Dim
presta1
As
New
RadDocument
Dim
msgHtml =
New
Html.HtmlFormatProvider
presta1 = msgHtml.Import(
"<SPAN><STRONG>Table content :</STRONG></SPAN><TABLE STYLE='border:1px solid black'><TR><TD>Marque</TD><TD>Type</TD><TD>N° série</TD><TD>Fluide</TD></TR><TR><TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD></TR><TR><TD>-</TD><TD>-</TD><TD>-</TD><TD>-</TD></TR></TABLE>"
)
Dim
fragment =
New
DocumentFragment(presta1)
section.Blocks.Add(fragment.EnumerateChildrenOfType(Of Table).ToList.First) 'its working but only with Table tag
'Saut de ligne
section.Blocks.Add(
New
Paragraph)
document.Sections.Add(section)
return document