Export Rad Report as Rtf as byte and import to RadRichTextBox

2 posts, 0 answers
  1. Abolhassan
    Abolhassan avatar
    7 posts
    Member since:
    Aug 2012

    Posted 23 Sep 2014 Link to this post

    I'm implementing a wpf application with rad control 2014 to export radreport to Rtf and save as byte to database then retrieve the data from database and display in RadRichTextBox.

    here's my code:

    Export to rtf format and save to database
    System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
    Telerik.Reporting.TypeReportSource typeReportSource = new Telerik.Reporting.TypeReportSource();
     Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
    Telerik.Reporting.InstanceReportSource instanceReportSource = new Telerik.Reporting.InstanceReportSource();
    instanceReportSource.ReportDocument = report;
    Telerik.Reporting.Processing.RenderingResult renderedReport = reportProcessor.RenderReport("RTF", instanceReportSource, null);

    and save the output of renderedReport.DocumentBytes to database. 

    Load the byte[] and bind to RadRichTextBox
    RadDocument document = null;
    IDocumentFormatProvider provider = new RtfFormatProvider();
    using (Stream stream = new MemoryStream(viewDocumentsCore.DocumentContent))
        document = provider.Import(stream);
    radRichTextBox.Document = document;

    But it causes error.

    I would appreciate for any help.

  2. Petya
    Petya avatar
    983 posts

    Posted 25 Sep 2014 Link to this post

    Hi Hassan,

    Please provide us with one of the documents in questions, so that we can look into the cause of the behavior and advise you further.

    Thank you in advance.

    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top