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

Report Book PDF File creation

6 Answers 338 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael Love
Top achievements
Rank 1
Michael Love asked on 22 Jan 2010, 07:05 PM
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.

 

6 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 25 Jan 2010, 03:32 PM
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.
0
Michael Love
Top achievements
Rank 1
answered on 25 Jan 2010, 03:46 PM
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
0
Steve
Telerik team
answered on 26 Jan 2010, 03:33 PM
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.
0
sumith
Top achievements
Rank 1
answered on 25 Mar 2016, 08:13 AM

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);

0
Stef
Telerik team
answered on 28 Mar 2016, 03:29 PM
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
0
David
Top achievements
Rank 1
Iron
Veteran
Iron
answered on 28 Mar 2016, 08:10 PM

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.

 

Tags
General Discussions
Asked by
Michael Love
Top achievements
Rank 1
Answers by
Steve
Telerik team
Michael Love
Top achievements
Rank 1
sumith
Top achievements
Rank 1
Stef
Telerik team
David
Top achievements
Rank 1
Iron
Veteran
Iron
Share this question
or