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

RadEditor, how to export rtf and load with formatted text

6 Answers 380 Views
Editor
This is a migrated thread and some comments may be shown as answers.
章民
Top achievements
Rank 1
章民 asked on 22 Oct 2012, 02:27 AM
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

6 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 22 Oct 2012, 03:11 PM
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.
0
章民
Top achievements
Rank 1
answered on 23 Oct 2012, 02:43 AM
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.
0
Accepted
Rumen
Telerik team
answered on 23 Oct 2012, 06:30 AM
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.
0
章民
Top achievements
Rank 1
answered on 26 Oct 2012, 12:50 AM
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?

 

0
Rumen
Telerik team
answered on 30 Oct 2012, 12:30 PM
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.
0
gayathri
Top achievements
Rank 1
answered on 07 Sep 2017, 06:34 AM

Hi Rumen,

Any update on RTF support tags

 

Tags
Editor
Asked by
章民
Top achievements
Rank 1
Answers by
Rumen
Telerik team
章民
Top achievements
Rank 1
gayathri
Top achievements
Rank 1
Share this question
or