Removing the default "untitled" title

2 posts, 0 answers
  1. William
    William avatar
    1 posts
    Member since:
    May 2015

    Posted 17 Mar Link to this post


    Using the RichTextEditor and retrieving [ MyRichTextControl.GetContent("HTML") ] from it using any text at all, the "title" of that property contains "Untitled".

    Here's the exact return value: <title>Untitled</title>

    Is there a simple way to not include a "title" by default, or null/blank it out ?

    Thanks in advance -B

  2. Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    3891 posts

    Posted 18 Mar Link to this post

    Hello, William,  

    The RadRichTextEditor.GetContent("HTML") method internally uses the HtmlFormatProvider.

    HtmlFormatProvider allows for import of HTML documents and respectively export of RadRichTextEditor to HTML. Additionally, the import/export settings provide modification options. HtmlFormatProvider exposes ExportSettings, which allow you to control the export of the RadRichTextEditor document. Thus, you can specify the HtmlExportSettings.Title property to an empty string for example and the "Untitled" value won't be exported. 

                HtmlExportSettings htmlExportSettings = new HtmlExportSettings();
                RadDocument document = this.radRichTextEditor1.Document;
                HtmlFormatProvider provider = new HtmlFormatProvider();
                htmlExportSettings.Title = ""; 
                provider.ExportSettings = htmlExportSettings;
                string html = provider.Export(document);

    It is not possible to ignore storing this title in the header. You can either specify its content as it is demonstrated above or just remove the specific text from the HTML content.

    I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

    Dess | Tech Support Engineer, Sr.
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top