RenderReport Question

2 posts, 0 answers
  1. ZHOU
    ZHOU avatar
    10 posts
    Member since:
    Feb 2014

    Posted 19 Dec 2014 Link to this post

    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);
    }
  2. Hinata
    Hinata avatar
    146 posts
    Member since:
    Dec 2013

    Posted 24 Dec 2014 in reply to ZHOU Link to this post

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