RadEditor, how to export rtf and load with formatted text

7 posts, 1 answers
  1. 章民
    章民 avatar
    20 posts
    Member since:
    Oct 2012

    Posted 21 Oct 2012 Link to this post

    I use ExportToRtf to save theEditor's content(Track Change), but it seems to lose the text format. When I reload the Rtf file I saved the text format is losed. If I export with ExportToPdf function, the text format is keeped. But there is no function to load pdf file. I prefer using Rtf. Does somebody know how to keep Editor's text format(track change) and save the content into a Rtf, and then load the Rtf file and show the content(keep Track Change) in Editor?

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim astr As String = theEditor.Text
        theEditor.ExportToRtf()
    End Sub
    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim totalStr As String = ""
        Using sr As StreamReader = New StreamReader("C:\Users\User\Downloads\RadEditorExport.rtf")
            Dim line As String
            Do
                line = sr.ReadLine()
                totalStr &= line
            Loop Until line Is Nothing
            sr.Close()
        End Using
        theEditor.LoadRtfContent(totalStr)
    End Sub
  2. Rumen
    Admin
    Rumen avatar
    14107 posts

    Posted 22 Oct 2012 Link to this post

    Hello,

    The importation from RTF support very limited set of tags.

    RadEditor uses two different free libraries to provide Import to RTF and Export to RTF features.

    The first one used to provide RFT to HTML importation is available in this CodeProject's article: http://www.codeproject.com/KB/recipes/RtfConverter.aspx.
    The library used for HTML to RTF exportation is available here http://www.codeproject.com/KB/HTML/XHTML2RTF.aspx.
    Both libraries are written by different developers and they are not fully compatible with each other.

    For your convenience I prepared a list of know limitations of the Import and Export features of both libraries:

    RFT to HTML (Import)

    bold
    - supported..
    italic - supported
    underline - supported
    foreground and background colors - supported
    table elements - unsupported
    images- unsupported
    indentations - unsupported
    superscript and subscript - unsupported

    HTML to RTF (export)


    bold - supported.
    italic - supported
    underline - unsupported
    foreground and background colors - unsupported
    table elements - partially supported - table borders are not exported
    images- unsupported
    indentations - supported
    font family and size - unsupported
    superscript and subscript - unsupported

    The unsupported scenarios are hard for development and require more time for implementations and testing. Our development is concentrated currently on producing valid XHTML content and the import and export problems are logged with medium priority in our ToDo list. That is why we could not provide firm estimate for when the unsupported features will be available.

    Please note that good RTF import and export tools are very expensive. If you are currently unsatisfied with the offered by RadEditor RTF functionality, you could search in Internet for another free or paid RTF to HTML importation and HTML to RTF exportation tools and you can export the content from RadEditor as shown in the following KB article: Converting RadEditor HTML to PDF format.


    Kind regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. 章民
    章民 avatar
    20 posts
    Member since:
    Oct 2012

    Posted 22 Oct 2012 Link to this post

    Another problem, could I export the editor's content into HTML format (middle button "HTML" in Editor/Track Change)?
    Editor / Track Change, the HTML in the middle Tab includes the formatted text. That is I want. If I can save and load the html, the problem maybe be solved.
  4. Answer
    Rumen
    Admin
    Rumen avatar
    14107 posts

    Posted 23 Oct 2012 Link to this post

    Hello,

    You can obtain the RadEditor's content as HTML via the RadEditor's server Content property.

    All the best,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  5. 章民
    章民 avatar
    20 posts
    Member since:
    Oct 2012

    Posted 25 Oct 2012 Link to this post

    Protected Sub ButtonSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonSave.Click
        Response.Cookies("myText").Value = theEditor.Content
    End Sub
     
    Protected Sub ButtonLoad_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonLoad.Click
        theEditor.Content = Request.Cookies("myText").Value
    End Sub

     

    I use cookie to save TheEditor's content, but when I load the cookie,visual studio will break at Request.Cookie and say please reference http://go.microsoft.com/fwlink/?LinkID=212874. Does someone know how to solve this problem?

     

  6. Rumen
    Admin
    Rumen avatar
    14107 posts

    Posted 30 Oct 2012 Link to this post

    Hello,

    I think that it is not a good idea to save the content in a cookie due to that the cookie has a quite limited size and the security issues that its usage imposes. How do you save the content in the cookie? Did you encode the < and > symbols to &lt; and &gt;. Have you tried to disable the validation as suggested in http://go.microsoft.com/fwlink/?LinkID=212874?

    Kind regards,
    Rumen
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  7. gayathri
    gayathri avatar
    1 posts
    Member since:
    Aug 2011

    Posted 07 Sep 2017 in reply to Rumen Link to this post

    Hi Rumen,

    Any update on RTF support tags

     

Back to Top