RichTextBox Text convert To HTML format

21 posts, 0 answers
  1. bob thomash
    bob thomash avatar
    35 posts
    Member since:
    Oct 2009

    Posted 30 Apr 2010 Link to this post

    Hello Friends !

    I m using visual studio 2010 Ultimate with Silverlight 4.
    I m using RIchTxtBox as my email Body in my silverlight Project.

    I want to Save RadRichTextBox Text in my database as HTML format

    how to convert RadRichTextBox Text into HTML???
    Please send me sample Code or project
  2. Mike
    Admin
    Mike avatar
    640 posts

    Posted 30 Apr 2010 Link to this post

    Hi bob thomash,

    Currently RadRichTextBox supports only plain text and XAML formats. We will be adding more formats like HTML, RTF for the official version in Q2. Let us know if we can help further at this point.

    Best wishes,
    Mike
    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 banner
  4. Glenn Morton
    Glenn Morton avatar
    4 posts
    Member since:
    Feb 2010

    Posted 14 May 2010 Link to this post

    Any idea on when/if you will be adding support for DOC, DOCX, ODT or PDF?
  5. Mike
    Admin
    Mike avatar
    640 posts

    Posted 18 May 2010 Link to this post

    Hello Glenn Morton,

    The DOCX and PDF formats are with higher priority in our plans. Docs will most probably be supported in Q2 and PDF soon after that. For now we are concidering ODT and DOC  (WordML) formats for Q3 release.

    Best wishes,
    Mike
    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.
  6. Glenn Morton
    Glenn Morton avatar
    4 posts
    Member since:
    Feb 2010

    Posted 18 May 2010 Link to this post

    Thats great to hear :)
  7. Nikhil Thaker
    Nikhil Thaker avatar
    22 posts
    Member since:
    Mar 2010

    Posted 30 Jul 2010 Link to this post

    Hi,

    Please let me know if HTML format is supported in RichTextBox now..?

    thanks..

  8. Ivailo Karamanolev
    Admin
    Ivailo Karamanolev avatar
    276 posts

    Posted 02 Aug 2010 Link to this post

    Hello Nikhil Thaker,

    Yes, HTML export and import is supported by RadRichTextBox. To access it, you'll either have to use RadRichTextBoxRibbonUI, which provides Save/Load functionality out-of-the-box or use HtmlFormatProvider class found in the assembly Telerik.Windows.Documents.FormatProviders.Html. Let us now if you need any further assistance.

    Best wishes,
    Ivailo
    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
  9. lori guymon
    lori guymon avatar
    23 posts
    Member since:
    May 2004

    Posted 06 Aug 2010 Link to this post

    Are there any sample applications that demonstrate how to do this (export in HTML format and bind to a database field) as I haven't been able to find any??
    Thanks
  10. Charles Bates
    Charles Bates avatar
    45 posts
    Member since:
    Feb 2010

    Posted 09 Aug 2010 Link to this post

    Hello,
    We have many user-editable objects in our application.  We need to serialize/de-serialize them frequently, as well as compare the RadRichTextBox's content with the ViewModel's representation.
    What is the most-straightforward way to do that?  It seems rather cumbersome to have to continually go through all the steps required to use the HtmlFormatProvider.

    Thanks for any information, and perhaps a sample...
    C. Bates
  11. Ivailo Karamanolev
    Admin
    Ivailo Karamanolev avatar
    276 posts

    Posted 09 Aug 2010 Link to this post

    Hello C. Bates

    Concerning the data binding, for SP1, which is coming this week, we have developed some supplementary classes that will allow you to bind the HTML, XAML or Text of a RadRichTextBox's document to a database field (or anything bindable in that sense). All this can happen directly in XAML, or in code behind.
    In Q2 you had to do the exporting yourself using HtmlFormatProvider and SP1 is to amend that. As it's coming in the next few days, we hope that's not going to reflect badly on your schedule.

    And regarding user-editable objects - currently, you can insert any control using InlineUIContainer, unfortunately, the serialization for this doesn't work. As a workaround you can serialize and reinsert the elements as you save the document. A fix for this will be available for Q3 and users will be able to provide their own serialization logic.

    Please let us know if you need any further assistance.

    Best wishes,
    Ivailo
    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
  12. Travis
    Travis avatar
    223 posts
    Member since:
    Jan 2003

    Posted 24 Aug 2010 Link to this post

    So... Are there samples or demos of how to use RichTextBox now with the HTML format?
  13. Ivailo Karamanolev
    Admin
    Ivailo Karamanolev avatar
    276 posts

    Posted 25 Aug 2010 Link to this post

    Hello Travis,

    Here's the newest demo showing how to use DataProviders with RadRichTextBox:
    http://demos.telerik.com/silverlight/#RichTextBox/Binding

    And here - the help article that will give you some insight into the methodologies:
    http://www.telerik.com/help/silverlight/radrichtextbox-how-to-binding-to-data-providers.html

    Here's a small snippet that contains two methods: one that takes a HTML string and returns a document (which you can later assign to RadRichTextBox) and one that takes a RadDocument and returns an HTML string:
    RadDocument FromHtml(string html) {
        return new HtmlFormatProvider().Import(html);
    }
    string ToHtml(RadDocument document) {
        return new HtmlFormatProvider().Export(document);
    }
    It's up to you to choose one from the options: either use HtmlDataProvider to bind the HTML text directly to something else, or manually use HtmlFormatProvider from code-behind.
    I hope this helps.

    Kind regards,
    Ivailo
    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
  14. Bhushan
    Bhushan avatar
    3 posts
    Member since:
    Sep 2010

    Posted 01 Sep 2010 Link to this post

    Hi,

    Can anyone help me regarding converting the inserted custom controls in to the rich textbox in to HTML.
    And provide me if you have any source code.

    Thanks,
    Bhushan
  15. Boby
    Admin
    Boby avatar
    595 posts

    Posted 03 Sep 2010 Link to this post

    Hi Bhushan,
    Please refer to the answer in this thread.

    Greetings,
    Boby
    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
  16. Mircea
    Mircea avatar
    3 posts
    Member since:
    Nov 2010

    Posted 26 Nov 2010 Link to this post

    Hello,

    RTF format is supported now by the RadRichTextBox?
    If not, it will be available soon?

    Thanks
  17. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 26 Nov 2010 Link to this post

    Hello Mircea,

    RTF support is not supported for now. It has been scheduled for Q1 2011, which is due around April next year. You can find information on the currently supported file formats and examples on their usage in this help article.
    If you have other questions, do not hesitate to contact us again.

    Sincerely yours,

    Iva
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
  18. Angeli
    Angeli avatar
    29 posts
    Member since:
    Apr 2011

    Posted 13 May 2011 Link to this post

    Hi, Ivailo.

    I would like to ask about this line of code here: [one that takes a HTML string and returns a document (which you can later assign to RadRichTextBox)]

    RadDocument FromHtml(string html) {
        return new HtmlFormatProvider().Import(html);
    }

    does is have any restrictions on the string literals?
    i tried to set the string  to the HTML file I exported coming from the RadGridView but nothing happens.
    <table style="border-collapse:collapse" border="1">
    <tr>
    <td style="width:45">ID</td><td style="width:113">CategoryName</td><td style="width:212">Description</td><td style="width:79">Quantity</td><td style="width:58">Price</td><td style="width:273">AdditionalDetails</td></tr>
    <tr>
    <td>1</td><td>Kayaks</td><td>Traditionally used by hunters</td><td>5</td><td>1999.99</td><td>asdfghjklasdfghjkl;asdfghjkl;asdfghjkl;sdfghjkl;</td></tr>
    <tr>
    <td>2</td><td>Canoes</td><td>Small, narrow, human-powered boat</td><td>6</td><td>1999.99</td><td>asdfghjklasdfghjkl;asdfghjkl;asdfghjkl;sdfghjkl;</td></tr>
    <tr>
    <td>3</td><td>Dinghies</td><td>Small boats, 2-3 meters long</td><td>7</td><td>1999.99</td><td>asdfghjklasdfghjkl;asdfghjkl;asdfghjkl;sdfghjkl;</td></tr>
    <tr>
    <td></td><td></td><td></td><td></td><td></td><td></td></tr>
    </table>

    is there a solution to this?
  19. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 13 May 2011 Link to this post

    Hello Angeli,

    The problem with the file is that the styles of the table cells specify widths without a measuring unit (which is invalid according to the CSS specification). If you add a measuring unit, e.g. 

    <td style="width:45px">
    the HTML will be properly imported.
    We have adjusted our import, so that if no measurement unit is appointed, pixels are inferred, although the CSS standard states that a unit must be present.

    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
  20. Angeli
    Angeli avatar
    29 posts
    Member since:
    Apr 2011

    Posted 13 May 2011 Link to this post

    oh now i see. thanks for the help!
  21. Олег
    Олег avatar
    1 posts
    Member since:
    Dec 2014

    Posted 09 Dec 2014 Link to this post

    Hello!
    I wanted to exclude all attributes when serialize td like this: <td>... and so on.
    Its explained there: http://www.telerik.com/help/wpf/radrichtextbox-features-import-export-settings.html
    I added to ignores these properties:

    htmlExportSettings.PropertiesToIgnore["td"].Add("border-top");
    htmlExportSettings.PropertiesToIgnore["td"].Add("border-bottom");
    htmlExportSettings.PropertiesToIgnore["td"].Add("border-left");
    htmlExportSettings.PropertiesToIgnore["td"].Add("border-right");
    htmlExportSettings.PropertiesToIgnore["td"].Add("padding");
    htmlExportSettings.PropertiesToIgnore["td"].Add("vertical-align");
    htmlExportSettings.PropertiesToIgnore["td"].Add("align");

    And result is:
    <td align="left" valign="top">...  =>  <td>...

    What's wrong?


  22. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 11 Dec 2014 Link to this post

    Hello Oleg,

    Thank you for contacting us.

    I can confirm that there is a problem with ignoring the export of attributes for table cell in html format.
    I have opened bug report item in our feedback portal where you could track the overall progress of the issue.

    Please excuse us for the inconvenience.

    On a side note we made some improvements in our help documentation. If you are interested you can check it at RadRichTextBox help for Silverlight or WPF.

    Regards,
    Mihail
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
DevCraft banner