Export Report Book Programmatically

6 posts, 0 answers
  1. Shane Woodruff
    Shane Woodruff avatar
    9 posts
    Member since:
    Mar 2010

    Posted 02 Aug 2012 Link to this post

    I want to programmatically export a report book, however this command fails when I try to compile with the error:

    Error 6 Argument 2: cannot convert from 'Telerik.Reporting.ReportCollection' to 'Telerik.Reporting.ReportSource'

    Telerik.Reporting.Processing.RenderingResult ReportOutput;


    ReportOutput = reportProcessor.RenderReport("xls", RB,



    I've seen a ReportBook passed to the reportProcessor in other online examples, so I'm not sure why it's failing. I'm running 2012 Q2.


  2. Peter
    Peter avatar
    1611 posts

    Posted 06 Aug 2012 Link to this post

    Hello Shane,

    With the latest version of Telerik Reporting - 2012 Q2 - we have introduced the concept of the report sources. Thus our suggestion is to utilize an InstanceReportSource as elaborated in Exporting Report Programmatically help article and as shown in the following code snippet:

    var instanceReportSource = new Telerik.Reporting.InstanceReportSource();
    instanceReportSource.ReportDocument = reportBook;
    var result = reportProcessor.RenderReport("XLS", instanceReportSource, deviceInfo);
    All the best,
    the Telerik team

    BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

  3. DevCraft banner
  4. Shane Woodruff
    Shane Woodruff avatar
    9 posts
    Member since:
    Mar 2010

    Posted 06 Aug 2012 Link to this post

    Thank you Peter. I was able to figure this out using your referenced link.
  5. MV
    MV avatar
    20 posts
    Member since:
    Dec 2015

    Posted 19 Feb Link to this post

    I created a report and I'm exporting it programmatically.  Here's the code

    Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
           Dim app As String = CType(Session.Item("App"), String)
           Dim deviceInfo As New System.Collections.Hashtable()
           Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor()
           Dim ContactReports As New Telerik.Reporting.Report
           Dim instanceReportSource = New Telerik.Reporting.InstanceReportSource()
           instanceReportSource.ReportDocument = New ContactReports.TestReport
           instanceReportSource.Parameters.Add(New Telerik.Reporting.Parameter("par_app", app))
           Dim result As Telerik.Reporting.Processing.RenderingResult = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo)
           Response.ContentType = "application/PDF"
       End Sub

    Everything works fine, but I would like to be able to create multiple reports of the same report, add them to a report book and export it.

    I've seen a lot of posts and documentation, but I'm having a hard time trying to figure it out. Any help will be appreciated.


  6. MV
    MV avatar
    20 posts
    Member since:
    Dec 2015

    Posted 19 Feb in reply to MV Link to this post

    Nvm, I figured it out!
  7. Stef
    Stef avatar
    2929 posts

    Posted 22 Feb Link to this post


    Just to verify for anyone interested. In the given code snippet you can replace the report instance (used by the InstanceReportSource) with an instance of a ReportBook.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner