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

SubReports

4 Answers 262 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
regis
Top achievements
Rank 1
regis asked on 07 Jul 2009, 10:50 PM
Hi Everyone,

I read this thread and apply it in order to add several subreports on the same detail section.

My problem is that the first sub report is more than one page and that messes with the render:

The first page is blank
The second page is filled with the first part of the first subreport
The third page is filled with the second part of the first subreport and the second subreport
The fourth page is blank
The last page is filled with the last subreport.

here is my code:
Telerik.Reporting.SubReport subRep;  
Unit unitX = Unit.Cm(0.1);  
Unit unitY = Unit.Cm(0.1);  
SizeU size = new SizeU(Unit.Cm(0.5), Unit.Cm(0.5));  
 
foreach (string wo in woArray)  
            {  
                
 
                //create subreport   
                subRep = new SubReport();  
                subRep.Size = size;  
                subRep.Location = new PointU(unitX, unitY);  
 
                subRep.ReportSource = new Report(wo);  
                unitY = unitY.Add(Unit.Cm(2));  
 
                 
                detail.Items.Add(subRep);  
 
            }  
 

Thank you.
 PS: I would like to have all subreports to begin on a new page regardless of the length of the predecing subreport if any

4 Answers, 1 is accepted

Sort by
0
regis
Top achievements
Rank 1
answered on 08 Jul 2009, 02:24 PM
Hi,
I made few tests and try to get only two sub reports in the detail section. The first one can fit on one page only.

here what i got:

- first page is blank
- second page is filled out with the subreport
- third page is blank
- fourth page is filled out with the subreport.

I am just interested in the detail section of the subreport (which have a header report section with a picture and a footer report section), so I try to remove every section (except the Detail section) of the subreport before adding it to the parent report but that didn't help.


As I am just interested in the detail section of the subreport Would it be possible to have something like several detail sections in the main report (as i know that normally a report can't have several detail sections)?

Thank you
0
regis
Top achievements
Rank 1
answered on 08 Jul 2009, 03:25 PM
I manage to get a workaround to get almost what i want.
There may be a property in my subreport configuration that include those blank pages.

I just add the detail section of the sub report to an empty report and that empty report become the new subreport.
Here is my code:

            foreach (string wo in woArray)  
            {  
                ReportLib.Report reportDetail;  
                Telerik.Reporting.Report tempRaport = new Telerik.Reporting.Report();  
                  
                reportDetail = new Report(wo);  
                  
                tempRaport.Items.RemoveByKey("detail");  
                tempRaport.Items.Add(reportDetail.Items["detail"]);  
                tempRaport.DataSource = reportDetail.DataSource;  
                  
                //create subreport   
                subRep = new SubReport();  
                subRep.Size = size;  
                subRep.Location = new PointU(unitX, unitY);  
                subRep.ReportSource = tempRaport;  
                detail.Items.Add(subRep);  
                  
            } 

But now my problem (because nothing is perfect) is that i can't get one subreport to begin on a new page. I tried to include some pagebreaks (either in the report and the subreport) but nothing worked (here is a link to what I am talking). The second subreport (on the 2nd page) begins right after the first report. i would like it to be on the 3rd page and the 3rd subreport on  4th page.

So if you could indicate how to insert a page break between each subreport that would be great

Thank you

Regis
PS: also if you know a better way than creating a template report for my primary question, that would be great too
0
Accepted
Steve
Telerik team
answered on 08 Jul 2009, 03:31 PM
Hello regis,

It would seem that creating those reports separately and combining them into a single report by using our ReportBook feature would be what you're looking for. Please review our documentation and live demo for more information.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
regis
Top achievements
Rank 1
answered on 08 Jul 2009, 09:16 PM
Hi Steve,
that's exactly what i want (well at least until my boss tell that it's not)

I have to admit I never go to check the reportbook feature: Shame on me!!!!

Thank you so much!!!!
Tags
General Discussions
Asked by
regis
Top achievements
Rank 1
Answers by
regis
Top achievements
Rank 1
Steve
Telerik team
Share this question
or