Page 1 of 1
PageHeaderBand with subreport build up in code
Posted: Mon Jun 24, 2013 1:20 pm
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
Re: PageHeaderBand with subreport build up in code
Posted: Tue Jun 25, 2013 5:51 am
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.
Re: PageHeaderBand with subreport build up in code
Posted: Tue Jun 25, 2013 6:40 am
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
Re: PageHeaderBand with subreport build up in code
Posted: Tue Jun 25, 2013 1:01 pm
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
Re: PageHeaderBand with subreport build up in code
Posted: Tue Jun 25, 2013 1:31 pm
by HighAley
Hello.
It's great. What was wrong in your code?
Thank you.
Re: PageHeaderBand with subreport build up in code
Posted: Tue Jun 25, 2013 1:42 pm
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
Re: PageHeaderBand with subreport build up in code
Posted: Wed Jun 26, 2013 6:34 am
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.
Re: PageHeaderBand with subreport build up in code
Posted: Wed Jun 26, 2013 11:57 am
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
Re: PageHeaderBand with subreport build up in code
Posted: Wed Jun 26, 2013 1:19 pm
by HighAley
Hello, Thorsten.
We are always glad to help you.
Let us know if you need any additional help.
Thank you.