views:

221

answers:

1

Hi, The required functionality I am aiming for is to pull out RTF content from a database, edit it through a web interface (with a WYSIWYG editor) and then place the modified text back in to the database (in RTF format).

The control that I am using to do this is Telerik RadEditor (we have a license already for these controls). In the most recent version there appears to be functionality to load in RTF content from a string or a stream, but the only method I can see that is exposed for getting RTF back out is exportToRTF(); this method modified the headers and allows you to save a RTF version of the content you have just edited as a file.

The functionality to convert from HTML to RTF must exist somewhere within their library as you can export a RTF file, but I can not find any publicly exposed methods to pass this in to a stream or a string.

Does anybody know of a way that I can convert the HTML back to RTF using the Telerik libraries without saving out to a file?

Thanks

A: 

I think the methods that do the actual conversion are not publicly available in the Telerik assembly, so your only choice is to use the built-in export functionality. You can add a handler for the ExportContent event. There you will have access to the content that will be saved to the file before the actual operation.

Since the export call changes the response of the current page request, you can create a new dummy page, add an editor there, set its .Content property to the content you wish to export, attach a handler to ExportContent and finally call the export method of the editor.

lingvomir
Worked a treat, thank you for your solution!Instead of creating the dummy page, I added a response redirect back to the current page (Response.Redirect(Request.Url.AbsoluteUri, True)). Not ideal, but I guess until they expose the functionality to get it back from a public method, it does the trick!Thanks again
hoombar