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

Adding multiple charts & tables in a single report

1 Answer 97 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pradeep
Top achievements
Rank 1
Pradeep asked on 10 Jan 2012, 12:39 PM
Hi,

I'm using Telerik Reporting Q2 in my application. In this, I'm creating report using the following code and it works fine:


//Code that calls the report designer goes here

ReportProcessor processor =
new ReportProcessor();
RenderingResult result = processor.RenderReport("PDF", report, null);
  
string fileName = "Report" + string.Format("{0:yyyy-MM-dd_hh-mm-ss-tt}", DateTime.Now) + ".pdf";
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
Response.ClearContent();
Response.OutputStream.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
Response.End();

Now, I want to add another result in the same report. For that, I did something like this:

byte[] documentBytes = new List<byte>().ToArray();
for(int i=0; i<count; i++)
{
            //Code that calls the report designer goes here
  
            ReportProcessor processor = new ReportProcessor();
            RenderingResult result = processor.RenderReport("PDF", report, null);
        
            documentBytes = documentBytes.Concat(result.DocumentBytes).ToArray();
}
  
string fileName = "Report" + string.Format("{0:yyyy-MM-dd_hh-mm-ss-tt}", DateTime.Now) + ".pdf";
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
Response.ClearContent();
Response.OutputStream.Write(documentBytes, 0, documentBytes.Length);
Response.End();

But in the resulting PDF, I'm only seeing the final result (I have chart and table inside the report) from the for loop. Does this have a solution? Suppose the for loop have been traversed two times, the resulting PDF should be having chart & table for the first item followed by chart & table for the second item.

Please help asap.
Thanks

1 Answer, 1 is accepted

Sort by
0
Pradeep
Top achievements
Rank 1
answered on 10 Jan 2012, 01:56 PM
Achieved this through ReportBook. Great tool. Thanks!
Tags
General Discussions
Asked by
Pradeep
Top achievements
Rank 1
Answers by
Pradeep
Top achievements
Rank 1
Share this question
or