Page 1 of 1

Add A dataBand In the middile of report

Posted: Sat Jul 14, 2018 1:29 pm
by Liewai25
Hi, ley say I have a report with

ReportTitleBand
GroupHeaderBand
DataBand1
DataBand2
FooterBand

If I want to add a new databand between the databand1 and databand2 in code, how do i achieve it? If using page.components.add(databand) , it will add at the bottom.

Re: Add A dataBand In the middile of report

Posted: Mon Jul 16, 2018 5:32 am
by Edward
Hi Liewai,

There are several ways to do that.

You could have a DataBand3 placed in the page beforehand but with Enabled=false property and to set Enabled=true when required.
If you have a look to the 'Code' tab in the Designer and check the auto-generated code there, you might find the 'under the hood' behaviour of the report engine, when the report is generated, something like that;

Code: Select all

            this.Page1.Components.AddRange(new Stimulsoft.Report.Components.StiComponent[] {
                        this.DataBand1,
                        this.DataBand3,
                        this.DataBand2});
As you mentioned, the order in which the databands are added is important in this case.

Thank you,
Edward