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

RenderReport Question

1 Answer 222 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
ZHOU
Top achievements
Rank 2
ZHOU asked on 19 Dec 2014, 03:31 PM
Good morning,

Below is the code i found from document~ I was trying to change PDF to CSV File. The problem is this method is being used in reportview or report?
Another question is what is reportName? I can pass parameters here but i dont know if it is report name here.

Thank you.

Telerik.Reporting.Processing.ReportProcessor reportProcessor =
new Telerik.Reporting.Processing.ReportProcessor();

// set any deviceInfo settings if necessary
System.Collections.Hashtable deviceInfo =
new System.Collections.Hashtable();

Telerik.Reporting.TypeReportSource typeReportSource =
new Telerik.Reporting.TypeReportSource();

// reportName is the Assembly Qualified Name of the report
typeReportSource.TypeName = reportName;

Telerik.Reporting.Processing.RenderingResult result =
reportProcessor.RenderReport("PDF", typeReportSource, deviceInfo);

string fileName = result.DocumentName + "." + result.Extension;
string path = System.IO.Path.GetTempPath();
string filePath = System.IO.Path.Combine(path, fileName);

using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create))
{
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
}

1 Answer, 1 is accepted

Sort by
0
Hinata
Top achievements
Rank 1
answered on 24 Dec 2014, 07:41 AM
Hi ZHOU,

To change the export from PDF to CSV you only need to replace the first argument of the RenderReport method with:

Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("CSV", typeReportSource, deviceInfo);

The reportName is the Assembly Qualified Name of the report as described in the comment there. If you are not sure what the assembly qualified name is, please check this page: http://msdn.microsoft.com/en-us/library/system.type.assemblyqualifiedname%28v=vs.110%29.aspx
Tags
General Discussions
Asked by
ZHOU
Top achievements
Rank 2
Answers by
Hinata
Top achievements
Rank 1
Share this question
or