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