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

Exporting to RTF using a stream

2 Answers 125 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Philip
Top achievements
Rank 1
Philip asked on 04 Jul 2014, 08:11 PM
I use crystal reports and use RTF Text interpretation for a description field and store the value of this description RTF in an MS SQL Database Text Column. I need to allow my users to create / edit this description via a web portal and am using the RadEditor. The import of RTF is fine using a memory stream, but I need to use the export to RTF and not have it download a file to the user, but use the exported RTF to store in the database field. Is there a way to override the export to export to a memory stream instead of a file for download?

Thanks,

Philip Carter

2 Answers, 1 is accepted

Sort by
0
SANJAY
Top achievements
Rank 1
answered on 05 Jul 2014, 04:23 AM
Hi Philip

At this point of time I donot know if Telerik control has such a function.

But this could work

byte[] byteArray = Encoding.UTF8.GetBytes(contents);
MemoryStream stream = new MemoryStream(byteArray);

Hope this works

Regards
0
Philip
Top achievements
Rank 1
answered on 05 Jul 2014, 02:52 PM
I found the answer and just in case anyone else needs it, I'm posting it here. And I want to say that Telerik is the best Web Toolkit I have ever used, there's always a way to do what I want to do. THANKS TELERIK!

​RTFDoc is a hidden field in my page. Since the e.ExportOutput is a string for RTF Exports, this worked out great

Protected Sub RadEditor1_ExportContent(sender As Object, e As Telerik.Web.UI.EditorExportingArgs) Handles RadEditor1.ExportContent

RTFDoc.Value = e.ExportOutput
If RTFDoc.Value > "" Then
encryption.PerformUpdateQuery("Update ProjectPhases set rtfDescription = null, Description = '" & Replace(RTFDoc.Value, "'", "''") & "', Description = " & Replace(RadEditor1.Text, "'", "''") & "' where ProjectPhaseID = " & CurrentPhaseID.Value)
End If

End Sub
Tags
Editor
Asked by
Philip
Top achievements
Rank 1
Answers by
SANJAY
Top achievements
Rank 1
Philip
Top achievements
Rank 1
Share this question
or