Report Book PDF File creation

7 posts, 0 answers
  1. Michael Love
    Michael Love avatar
    49 posts
    Member since:
    Sep 2009

    Posted 22 Jan 2010 Link to this post

    Hi there.

    I am using Telerik Reporting and I have a need that when a user selects multiple people from a RadGrid, I need to create a single report (for audit purposes) for each person selected. I am creating the individual pdf reports programmatically and saving them to disk etc just fine. Another requirement is to also create a "combined" pdf report that has all of the individual reports within it. This pdf would be the one presented to the user. So, I did some reading and it looks like the ReportBook  feature should be able to help me.

    I have code that is like this (simplified):

     

    ReportBook reportBook = new ReportBook();

     

    reportBook.DocumentName =

    "Combined";

     

     

    foreach (selected person)
    {
        // generate the pdf report by exporting directly to disk
        
        // Add the report to the report book
        reportBook.Reports.Add(report);
    }

    Now, I need to create another PDF of the combined report.

    I am not sure how to accomplish this. The examples/help articles don't show that detail.

    Can you help me out?

    Thanks, Mike

    P.S. - I am really starting to understand and like your product. I love the fact that you can do so much programmatically.

     

  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 25 Jan 2010 Link to this post

    Hi Michael,

    Not really sure what you mean by "I need to create another PDF of the combined report". The ReportViewer Report property is of type IReportDocument, which means that it accepts both reports and reportbooks. To what format you would export the generated document is up to you.

    Greetings,
    Steve
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. DevCraft banner
  4. Michael Love
    Michael Love avatar
    49 posts
    Member since:
    Sep 2009

    Posted 25 Jan 2010 Link to this post

    Hi Steve.

    Let me clarify. I have a RadGrid that is a list of people. The user selects 1 to many of these people and executes a report. The requirement I have is twofold.

    1. For legal reasons, I need to create a report that contains only the individual data for each selected person. So, if I selected 3 people (Dave, Fred and Sally), I need to create 3 pdf reports.
        - Dave's report (with only Dave's info in it)
        - Fred's report (with only Fred's info in it)
        - Sally's report (with only Sally's info in it)
    These reports are created programmatically and are saved directly to disk as PDFs

    2. Additionally, I need to present the user with a single report that combines all 3 reports

    So, my question is this: Is there a way I can leverage ReportBook to concatenate the report results into a single combined pdf or do I need to basically create another report and execute it again? Basically, I don't want to have to reexecute datasets to create the combined report. Does that make sense?

    Please advise.

    Thanks, Mike
  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 26 Jan 2010 Link to this post

    Hello Michael,

    Thank you for the clarification. It seems however that you have not understood my previous reply. Generally speaking a report is created so that it can be printed or exported at some point. And as the documentation says the main goal of a report book is combining different reports into one for the purposes of printing them at once or exporting them to a single file.
    So in short, once you already have the generated ReportBook, you can export it to pdf as easily as you would do with the reports. For example the code in Exporting a report to PDF programmatically can be changed so that the ExportToPDF() function accepts Telerik.Reporting.IReportDocument as argument i.e. both reports and report books.

    Best wishes,
    Steve
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  6. sumith
    sumith avatar
    4 posts
    Member since:
    Mar 2016

    Posted 25 Mar Link to this post

    Hello telerik ,I have some doubts about ReportBook. Right now i am using Q1 2016 and MVC5 .I am passing params to reports and generating PDF for every single member. But now my user requested to make all in one PDF for easy print purpose.So can you please give me idea how to implement . If available send me some sample code in c#. Its very urgent right now.
    Please assist me ASAP. Thanks in advance.

    Sample Code:

    typeReportSource = new UriReportSource { Uri = reportPath };

           
                    for (int i = 0; i < ACodes.Count; i++)
                    {
                        for (int j = 0; j <= strArray.Length; j++)
                        {
                            claimModel = getEmpID(checkEmpType, staffCodes[i], strArray[j]);                        
                        }
                    typeReportSource.Parameters.Add(new Telerik.Reporting.Parameter("ABC", "XYZ"));

                        result = reportProcessor.RenderReport("PDF", typeReportSource, null);
                        string fileNamewithExtn = result.DocumentName + "." + result.Extension;
                        generatePDF(checkEmpType, claimModel, fileNamewithExtn);

  7. Stef
    Admin
    Stef avatar
    3036 posts

    Posted 28 Mar Link to this post

    Hello Sumith,

    Below is quote from your colleague's ticket on the same question:

    "The main purpose of Report Book is to combine separate reports to one single report that you can export at once.

    An example on how to export a report programmatically is provided in Exporting Report Programmatically help article.


    We would also recommend reviewing sample Report Book implementation located in Telerik Reporting installation folder (default path is C:\Program Files (x86)\Telerik\Reporting <version>\Examples\CSharp\ReportLibrary\ReportBook).


    If the ReportBook has to be displayed in a viewer, you can use a TypeReportSource, or InstanceReportSource by applying a custom resolver in the Reporting REST service's configuration. In the resolver's Resolve method is received a string sent by the viewer's reportSource.report. Based on this string you can determine which reports to get, deserialize TRDX files if needed, and add them in a ReportBook. Finally, you need to return a valid report source object.


    If the ReportBook will be exported directly, you can wrap it in a report source object (InstanceReportSource or TypeReportSource), and then export it in code - Exporting Report Programmatically.
    "



    If you are working on the same case, please let us use only one thread in order to keep a better track on the exchanged information.

    Thank you for your understanding.

    Regards,
    Stef
    Telerik
    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
  8. David
    David avatar
    90 posts
    Member since:
    Jan 2011

    Posted 28 Mar Link to this post

    I do not know if this helps you however I make use of the Report Book feature in a budgeting program.  The program contains many dozen individual reports which can be individually run.  I have constructed a "build final report" option that allows a clerk to specify the order reports appear within a collective "budget book".    That budget book is basically a single Telerik Report Book which is a collection of populated report documents for each budget report designated by the budget clerk.  I then simply export the report book object either to disk, as a PDF or to the screen.

    In my case my resulting .PDF files are 800-900 pages in length containing dozens of layouts.  The report book control performs elegantly and in a timely manner.

     

Back to Top
DevCraft banner