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

Report formatting problem when adding dynamic subreport

3 Answers 215 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
VH
Top achievements
Rank 1
VH asked on 04 Jan 2011, 11:16 PM
(I am using the latest version of Q3 release.)
I created a master report which contains a list of dynamically generated sub-reports. 
foreach (ParameterValuesReportDataSource ds in dss)
{
 IndividualParameterReport subreport = new IndividualParameterReport(ds);
 
 SubReport subReport = new SubReport();
 subReport.ReportSource = subreport;
 detail.Items.Add(subReport);
}

I expected these sub-reports to be displayed one by one on the same page. However, the result report are splited into two pages, as shown in noDocking_page1.png and noDocking_page2.png.
Later I found that if I add a line: subReport.Dock = System.Windows.Forms.DockStyle.Top, sub-reports can be displayed within one page.
But they are kinda overlay, and still show two pages with the second page is empty, as shown in docking_page1.png and docking_page2.png.

Can anyone help with it? Thank you in advance.

Cheers,

VH

3 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 07 Jan 2011, 08:50 AM
Hello VH,

I have noticed that you have not set the SubReport's Location and Size properties and they are mandatory. Please set both in order to avoid items overlapping that will result in items being rendered over the right page margin causing a new (blank) page to be created. 

Generally to see which items are causing the problem, simply change their background to a different, more contrasting color and export it to PDF. The rendered report will immediately give you a clue about the items which are at fault.

Generally there are several cases when empty page may occur:

  • Report Width is greater than than the available page space (Page Width - Left Margin - Right Margin).
  • There is a sub-report, which contains a report that is too wide, and while at design-time that is not obvious, at run-time it might cause the carry over to occur.
  • There is a report item with boundaries going out to the right from its parent section.

For additional information check out the Problem: Telerik Reporting renders blank pages KB article.

Best wishes,
Peter
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
VH
Top achievements
Rank 1
answered on 10 Jan 2011, 01:24 AM
Hi,

Thank you for your reply, I have fixed the empty page problem by decreasing the width of sub-reports.
But the sub-reports are generated at run time so the height could be different, so I can't set the location.

With the following code:
foreach (ParameterValuesReportDataSource ds in dss)
{
IndividualParameterReport subreport = new IndividualParameterReport(ds);
SubReport subReport = new SubReport();
subReport.ReportSource = subreport;
detail.Items.Insert(0, subReport);
}

The result looks like attached image: auto.png
It seems like it gets the height and width of the first sub-report correctly, and I thought in this case, if I set the Dock of the sub-report to Top, I should get what I want, but the resulting sub-reports overlaps. (see attached image: docktop.png)

I don't understand how it works, can you please help with it. Thanks.

Regards,

VH
0
VH
Top achievements
Rank 1
answered on 10 Jan 2011, 04:56 AM
Hi,

My problem has been fixed by setting the sub-report size to a random value.

Thanks anyway.

VH
Tags
General Discussions
Asked by
VH
Top achievements
Rank 1
Answers by
Peter
Telerik team
VH
Top achievements
Rank 1
Share this question
or