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

HtmlTextBox question

7 Answers 224 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dave Hayward
Top achievements
Rank 1
Dave Hayward asked on 12 Jun 2011, 04:05 PM

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 
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

Sort by
0
Iva Toteva
Telerik team
answered on 13 Jun 2011, 12:25 PM
Hi Dave Hayward,

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
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Michael Hilgers
Top achievements
Rank 1
answered on 23 Aug 2011, 10:32 AM
It would be a really great feature if the Report HtmlTextBox and RadRichTextBox would be compatible. Please let us / me know if there is some progress regarding this (even internal builds).

Michael
0
Iva Toteva
Telerik team
answered on 26 Aug 2011, 10:30 AM
Hi 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 

Greetings,
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 >>

0
CHRISTIAN
Top achievements
Rank 1
answered on 12 Oct 2012, 06:57 AM
Hi,

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?
0
Mihail
Telerik team
answered on 16 Oct 2012, 09:35 AM
Hello Christian,

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.

Regards,
Mihail
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Scott
Top achievements
Rank 1
answered on 18 Sep 2016, 12:30 PM

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.

0
Stef
Telerik team
answered on 21 Sep 2016, 09:07 AM
Hello Scott,

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
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
General Discussions
Asked by
Dave Hayward
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Michael Hilgers
Top achievements
Rank 1
CHRISTIAN
Top achievements
Rank 1
Mihail
Telerik team
Scott
Top achievements
Rank 1
Stef
Telerik team
Share this question
or