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

Silently export RadEditor to RTF

8 Answers 195 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Mihai Dinculescu
Top achievements
Rank 1
Mihai Dinculescu asked on 17 Nov 2010, 07:31 PM
Hello

I need to export a RadEditor to a RTF, but I need to do it silently on the server and not popup a saveas window to the user. How can I achieve this please ?

Regards
Mihai

8 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 17 Nov 2010, 09:38 PM
Hello Mihai,

There is a OpenInNewWindow attribute in the ExportSettings inner tag, which value should be set to false, e.g.

<telerik:RadEditor ID="RadEditor1" runat="server" >
    <ExportSettings OpenInNewWindow="false" ></ExportSettings>
</telerik:RadEditor>

This setting will not open the Save dialog.
You can export the content as RTF on the server via the new OnExportContent event property of RadEditor.

Please, see this forum thread for more information: get RTF string or stream.


Best wishes,
Rumen
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Mihai Dinculescu
Top achievements
Rank 1
answered on 17 Nov 2010, 09:59 PM
I have already tried that with no luck. The window still opens.

But my problems are a lot bigger now. It seems that after I LoadRtfContent() a RTF file that was previously saved using ExportToRtf() the whole file is messed up when loading it again in RadEditor.

If I open it in wordpad it looks ok but if I save it (using WordPad) I get the "a text cannot appear on root level, must be child of a group: '' error next time I try to load it inside RadEditor.

I file that guarantees this behavior can be found at: http://dev.good-intentions.eu/test_file.rtf

I feel really bad about this because I just convinced my client to spend the full price for Telerik controls and they really need to be able to load/save RTF files freely.

So any help would be greatly appreciated.

Regards
Mihai
0
Rumen
Telerik team
answered on 22 Nov 2010, 06:06 PM
Hi Mihai,

I was able to reproduce the problem and logged it for research. I noticed that if I save the non working RTF file after that in MS Word 2007 the problem disappears. It seems related to WordPad, but our developers should research it in more details and hopefully fix it. If possible, instruct your users to edit the RTF files in MS Word instead of WordPad.

As to the silent update: Attach an eventhandler to the OnExportContent event and interrupt the ExportContent event by calling Response.Redirect(url). Therefore the browser will not ask whether to open or save the content.

You can find attached here an example demonstrating how to export the editor's content as PDF on the server using the new OnExportContent event property of RadEditor. The solution for RTF export should be similar.

Here is additional information about the RTF import and export features of RadEditor:

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/recipes/RtfConverter.aspx.
As you can see 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. I was able to export bold formatting from the provided by you Bold.rtf file.
italic - supported
underline - supported
foreground and background colors - supported
table elements - unsupported
images- unsupported
indentations - unsupported


HTML to RTF (export)


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

You can see the following video which demonstrates how the RTF import and export features work:
http://screencast.com/t/7ag9iDfqpZ.

You should also note that good RTF import and export tools are very expensive and if we integrate such tools in RadEditor, the price of the Telerik suite will be increased a lot. That is why if you are currently not satisfied with the offered by RadEditor RTF functionality, you can search in Internet for another free or paid RTF to HTML importation and HTML to RTF exportation tools and we will help you to integrate them with RadEditor.

Sincerely yours,
Rumen
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Rumen
Telerik team
answered on 22 Nov 2010, 06:11 PM
Hi Mihai,

Here you can find the PITS Issue that I created for the problem: Public URL.

Kind regards,
Rumen
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Vina
Top achievements
Rank 1
answered on 16 Nov 2011, 07:22 AM
Hi,

I am using the RadEditor for ASP.NET version 2011 ones (Q2 2011).
And notice that the export to RTF still does not support images.. but on the other hand, I am using your RichTextBox Control in Silverlight and this one has no problem in exporting images to RTF format.
Is there anyway I can get the same export functionality to RTF in ASP.NET as in the Silverlight ones?

Thank you.

Vina.
0
Princy
Top achievements
Rank 2
answered on 16 Nov 2011, 09:28 AM
Hello Vina,

Take a look into the following forum thread which discussed the same.
unable to export .jpg image from radEditor to MSWord

Thanks,
Princy.
0
Goldie
Top achievements
Rank 1
answered on 29 Mar 2012, 06:49 PM
I am using RadEdior version 2012.1.301.35. 
I want to know if the underline formatting functionality has been fixed in this version for ExportToRtf() function.
0
Rumen
Telerik team
answered on 30 Mar 2012, 01:47 PM
Hello,

The issue is not yet fixed. Our ToDo list for Q2 2012 is pretty set and the improvement of the RTF import and export features was postponed.

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.
Tags
Editor
Asked by
Mihai Dinculescu
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Mihai Dinculescu
Top achievements
Rank 1
Vina
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Goldie
Top achievements
Rank 1
Share this question
or