HtmlTextBox question

8 posts, 0 answers
  1. Dave Hayward
    Dave Hayward avatar
    40 posts
    Member since:
    Jul 2012

    Posted 12 Jun 2011 Link to this post

    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 
    xmlns="<A http: xhtml?? 
    http-equiv="Content-Type" content="text/html; charset=utf-8" 
    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="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?


  2. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 13 Jun 2011 Link to this post

    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.

    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
  3. DevCraft R3 2016 release webinar banner
  4. Michael Hilgers
    Michael Hilgers avatar
    76 posts
    Member since:
    Apr 2010

    Posted 23 Aug 2011 Link to this post

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

  5. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 26 Aug 2011 Link to this post

    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 

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

    CHRISTIAN avatar
    39 posts
    Member since:
    Nov 2010

    Posted 12 Oct 2012 Link to this post


    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?
  7. Mihail
    Mihail avatar
    181 posts

    Posted 16 Oct 2012 Link to this post

    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.

    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  8. Scott
    Scott avatar
    11 posts
    Member since:
    Dec 2015

    Posted 18 Sep in reply to Iva Toteva Link to this post

    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.



  9. Stef
    Stef avatar
    2914 posts

    Posted 21 Sep Link to this post

    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.

    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
DevCraft R3 2016 release webinar banner