
I'm trying to place html into an HtmlTextBox and I'm getting the error:
"An error has occurred while processing HtmlTextBox 'htmlTextBox1'.
unexpected DTD declaration. Line 1 Position 9."
This message is rendered in the report.
The html being placed is :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<
A
xhtml1-transitional.dtd?? DTD xhtml1 TR www.w3.org
http:><
HTML
'>http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><
html
</A>
xmlns="<
A
www.w3.org http: xhtml??
1999><
META
'>http://www.w3.org/1999/xhtml"><
head
><
meta
</A>
http-equiv="Content-Type" content="text/html; charset=utf-8"
/><
title
>Untitled</
title
><
style
type
=
"text/css"
><
BR
>.p_778AAEB1 { margin: 0px 0px 10px 0px;text-align:
left;text-indent: 0pt;padding: 0px 0px 0px 0px; } <
BR
>.s_E6FD2046 { font-family:
'Verdana';font-style: Normal;font-weight: normal;font-size: 16px;color: #000000;
} <
BR
></
style
></
head
><
body
><
p
class
=
"p_778AAEB1"
><
span
class
=
"s_E6FD2046"
>Some Sample Text</
span
></
p
></
body
></
html
><
BR
>
This html was actually generated by the Telerik Silverlight 'MSWordEditor' and then converted as follows:
public string RadDocumentToString(RadDocument doct)
{
IDocumentFormatProvider htmlProvider = DocumentFormatProvidersManager.GetProviderByExtension(".html");
byte[] buffer = htmlProvider.Export(doct);
UTF8Encoding utf8 = new UTF8Encoding();
string text = utf8.GetString(buffer, 0, buffer.Length);
return text;
}
Does anyone have an idea of what might be happening?
TIA
7 Answers, 1 is accepted
First of all, you don't need to do any additional processing to the exported document, as the Export method of HtmlFormatProvider returns a string. The following code will be sufficient:
public
string
RadDocumentToString(RadDocument doct)
{
HtmlFormatProvider htmlProvider = DocumentFormatProvidersManager.GetProviderByExtension(
".html"
)
as
HtmlFormatProvider;
string
text = htmlProvider.Export(doct);
return
text;
}
With regard to the issue in your post, unfortunately the HTML that HtmlFormatProvider exports is not fully compatible with the HTML that HtmlTextBox recognizes. The list of supported tags in HtmlTextBox can be found here and the customization possibilities of the HtmlFormatProvider are described in this article. Maximum compatibility is achieved by setting the DocumentExportLevel to Fragment ad StylesExportMode to Inline, but there are other issues that cannot be worked around, namely the recognition of Bold and Underlined parts of the document.
If you would be showing the exported document in a report, we can send you the source code of RadRichTextBox and HtmlFormatProvider, so that you can create a custom HTML format provider that will be compatible with HtmlTextBox. In that case, please open a support ticket requesting the source code.
We will try to make HtmlTextBox and RadRichTextBox compatible as soon as possible, but the time frame is still not certain.
Greetings,
Iva
the Telerik team

Michael
This feature has not been scheduled yet and no progress on it has been made so far. I am creating a PITS issue, which you can track and vote for in order to increase its priority:
You can follow the PITS Issue by its ID: 7583
Here you can find the PITS Issue: Public URL
Iva
the Telerik team
Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

I have the same problem with the textbox from time to time.
Is there any way to recognize the incorrect generation of the report and to abort it?
I am afraid I don't understand what problem you are observing.
This thread mainly discusses the interoperability between RadRichTextBox for Silverlight and HtmlTextBox for Reporting. The information is rather outdated and as you can see from the PITS issue, we have made some progress on this matter introducing export settings for RadRichTextBox's HtmlFormatProvider. These settings allow the export of the document in a way that achieves best compatibility with the HtmlTextBox from Reporting. You can read more about this here.
There are, however, some limitations that cannot be solved by export settings, because the HtmlTextBox does not support particular features - for example, paragraphs cannot have spacing after different than the default one. More information on the supported tags in the control is available in this article.
Please, check if using these settings is sufficient for the requirements of your application thoroughly before deciding on the components you will use in your application.
Mihail
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Any progress on this? I am having the same issue.
I have a table stored as DOCX format in my DB. I can get the HTML code back, using the DOCX- and HTML- FormatProvider, and placed into a textbox in the report. But I cannot get it back as a table in the HTML textbox. I am open to alternative suggestions. I just need the table to show in up a my report.
Thanks.
I believe your post is related to our discussion regarding RadDocument content usage in reports.
Please check my last post in Including a Rad Document in a Telerik report.
Regards,
Stef
Telerik by Progress