PageHeaderBand with subreport build up in code

Stimulsoft Ultimate discussion
Post Reply
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

PageHeaderBand with subreport build up in code

Post by tpontow »

Hello Stimulsoft support,

i'm trying to build up the following report structure in C# code:

Main report page with a PageHeaderBand. Inside this PageHeaderBand is a subreport. This subreport (page) contains a DataBand which is bound to a business object with some data rows. I tried almost everything but it does not work (no data from business object is shown in rendered report). I build up the same structure in designer and it works. So i compared the generated C# code of that designed report with my code but i did not found out what is wrong with it. :-(

Can you please provide me with a small sample code which meet my structure and is not a designed report then saved as C# code?

Thanks and kind regards
Thorsten Pontow
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: PageHeaderBand with subreport build up in code

Post by HighAley »

Hello.

Please, read next forum topic Building Report Template in Code
There is described how to create report templates with business objects in C# code.

Thank you.
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

Re: PageHeaderBand with subreport build up in code

Post by tpontow »

Hello Aleksey,

i have no problem with the business objects. My problem is to create a subreport inside a HeaderBand / PageHeaderBand as i described it in my post above. I need the exact structure i described above and i cannot get it work in C# code.

Thanks
Thorsten Pontow
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

Re: PageHeaderBand with subreport build up in code

Post by tpontow »

Hello Aleksey,

i finally changed some generated code from the report designer and fitted it to my needs. So, it's working now.

Thank you
Thorsten Pontow
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: PageHeaderBand with subreport build up in code

Post by HighAley »

Hello.

It's great. What was wrong in your code?

Thank you.
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

Re: PageHeaderBand with subreport build up in code

Post by tpontow »

Hello Aleksey,

my main problem was that i set the DockStyle of the subreport to DockStyle.Fill. I thought that with that the ClientRectangle of the subreport component would be set automatically to the size of the parent component (PageHeaderBand in my case) when added. But that's not so. I had to define the ClientRectangle by myself like

Code: Select all

subReportForContainerContent.ClientRectangle = new RectangleD(0,0, subReportForContainerContent.Page.Width, subReportForContainerContent.Parent.Height);
With that i can now see the subreport in the PageHeaderBand as expected.

That took me to some time to find out :-)

Thanks and regards
Thorsten Pontow
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: PageHeaderBand with subreport build up in code

Post by HighAley »

Hello.

It's a strange behavior. We couldn't reproduce your issue.
But you could try to use next methods after report is created:

Code: Select all

page.DockToContainer();
page.Correct();
Thank you.
User avatar
tpontow
Posts: 206
Joined: Thu Sep 06, 2012 8:46 am
Location: Bonn, Germany

Re: PageHeaderBand with subreport build up in code

Post by tpontow »

Hello Aleksey,

that works too. I now put the following code after the report creation:

Code: Select all

 foreach (StiPage page in Pages)
         {
             page.DockToContainer();
             page.Correct();
          }
With that i do not have to set the ClientRectangle of the subreports by myself.

Thanks and regards
Thorsten Pontow
Thorsten Pontow

It is easier to write an incorrect program than to understand a correct one. (Alan J. Perlis, Epigrams in programming No. 7)
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: PageHeaderBand with subreport build up in code

Post by HighAley »

Hello, Thorsten.

We are always glad to help you.
Let us know if you need any additional help.

Thank you.
Post Reply