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

Export Rad Report as Rtf as byte and import to RadRichTextBox

1 Answer 96 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Abolhassan
Top achievements
Rank 1
Abolhassan asked on 23 Sep 2014, 09:04 AM
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.

Hassan
Regards

1 Answer, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 25 Sep 2014, 03:51 PM
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.

Regards,
Petya
Telerik
 
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.
 
Tags
RichTextBox
Asked by
Abolhassan
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or