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

Sub reports layout problem

1 Answer 260 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bruno
Top achievements
Rank 1
Bruno asked on 28 Aug 2008, 01:00 PM
DataTable table; // results from store procedure. 
IndicadoresDetalhado subReportDetalhado; //the sub report ReportSource. 
SubReport subReport; //the sub report. 
 
public IndicadoresBase(clsParametros pParametros) 
        { 
            InitializeComponent(); 
 
            string[] centrais = pParametros.param_central.Value.ToString().Split(','); 
 
            for (int i = 0; i < centrais.Length; i++) 
            { 
                pParametros.param_central.Value = centrais[i]; 
                table = clsRelatorio.RelatoriosIndicadoresGet(pParametros); 
                subReportDetalhado = new IndicadoresDetalhado(table); 
 
                subReport = new SubReport() 
                { 
                    Location  = new PointU(new Unit(0.0, ((UnitType)(UnitType.Cm))), new Unit(20.0 * i, ((UnitType)(UnitType.Cm)))), 
                    Name = "subReport"
                    ReportSource = subReportDetalhado, 
                    Size = new SizeU(new Unit(28.7, ((UnitType)(UnitType.Cm))), new Unit(20.0, ((UnitType)(UnitType.Cm)))), 
                }; 
 
                this.detail.Items.Add(subReport); 
            } 
 
            ExibirParametros(pParametros); 
        } 
Hello.

In my report, I'm programatically adding news sub reports as much as I have data tables from the store procedure result set. All the code stuff is in the constructor of the base report, like the code above.

I know that probably that's the not best approach when working with sub reports, but the time that I codded that, that's the way I found to achieve my objectives.

The main problem is about layout. When viewing from browser, everything works fine. But, when I export my report to PDF, I cannot display a sub report per page, unless I change the 'Size' property of my subreport. Setting it to a value that fits on PDF display, the HTML display change, putting the subreports side by side.

What I want to know is if there is a way to display each sub report created per page. I mean, each time that i add a item to the main report, it creates a new page for it.

Thanks in advice.

1 Answer, 1 is accepted

Sort by
0
Hrisi
Telerik team
answered on 01 Sep 2008, 03:18 PM
Hi Bruno,

From your code we see that you try to put all subreports in the detail section of the main report. With this approach it is impossible to place page-break after every subreport. In our engine page-breaks can be placed only before or after report sections.

In order to explain our viewpoint of the problem we've prepared a simple project with master and detail reports.

Master report IndicadoresBase.cs is bound to a list of strings Parameters representing pParametros collection of strings. In this manner we have as many details sections as the length of the Parameters. For the detail section we set PageBreak = After. In the detail section we place a SubReport item for which parameter ParamCentral is defined with value set to the current data item(parameter).

The subreport IndicadoresDetalhado.cs is bound to the DataTable trough NeedDataSource. In the handler we implement the logic for getting data depending of the parameter (the parameter name is the same as for SubReport item parameter - ParamCentral).

As a result we can see a report with report header on the first page and every subreport started from the begining of subsequent pages.

Please, let us know if this helps you solve the problem. Do not hesitate to contact us if you have any additional questions.

All the best,
Hrisi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
General Discussions
Asked by
Bruno
Top achievements
Rank 1
Answers by
Hrisi
Telerik team
Share this question
or