Exporting to RTF using a stream

3 posts, 0 answers
  1. Philip
    Philip avatar
    17 posts
    Member since:
    Feb 2014

    Posted 04 Jul 2014 Link to this post

    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. SANJAY
    SANJAY avatar
    61 posts
    Member since:
    Jun 2012

    Posted 04 Jul 2014 in reply to Philip Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Philip
    Philip avatar
    17 posts
    Member since:
    Feb 2014

    Posted 05 Jul 2014 Link to this post

    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
Back to Top