Table header "Print on: except first page" problem

Stimulsoft Ultimate discussion
Post Reply
User avatar
John
Posts: 128
Joined: Tue Feb 01, 2011 3:56 am
Location: England

Table header "Print on: except first page" problem

Post by John »

Hello Team,

I have a problem when using a table header which should not be displayed on the first page where the table appears. The report in which I use the table is created in c# code dynamically, taking parts from a template. I have included the MRT template file in the attachments here. You can see that the table header is defined as "Print on: except first page".
All works well when a create a simple report file (see 'Correct_Rendering.pdf'). The table begins with a row containing two icons (Community Life and InterRisk). If the table had gone on to a second page, the table header would have been displayed - so all correct here.
The problem arises when I am merging sub-reports into a main report. As you can see here:
The attachment Info.png is no longer available
Please also see the file 'Not_Correct.pdf' - the table header thinks it is not on the first page of the table and displays itself. Of course, it is not the first page of the main report but this should not make any difference.
Do you have some trick I can use to get the table header to correctly check whether the table is on its first page or not? Perhaps there is some way using an event. I have tried with a DoublePass rendering of the sub-report but it did not help. I also tried adding the sub-report to the main report by resetting the page numbering as follows: mainReport.SubReports.Add(stiReport, true, false); - This causes the table header not to display on the first page of the table but completely messes up the page numbering for the main report, which I am displaying at the end of each page - therefore, no luck there.

Thanks in advance.

John Kitching
Attachments
Info.png
Info.png (62.95 KiB) Viewed 4142 times
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Table header "Print on: except first page" problem

Post by Lech Kulikowski »

Hello,

Please send us a sample which reproduces the issue for analysis.

Thank you.
User avatar
John
Posts: 128
Joined: Tue Feb 01, 2011 3:56 am
Location: England

Re: Table header "Print on: except first page" problem

Post by John »

Hallo,

I have created a test project which reproduces the issue (Visual Studio 2017 - c#). Two templates are loaded - the first just displays a simple page. The second contains a table where the header is set to "don't display on first page". As you can see (in output.pdf), the table header is being displayed on the first page on which the table appears, which is not what I want or would expect.

Thanks and regards,

John Kitching
Attachments
Output.pdf
(102.38 KiB) Downloaded 177 times
User avatar
John
Posts: 128
Joined: Tue Feb 01, 2011 3:56 am
Location: England

Re: Table header "Print on: except first page" problem

Post by John »

Visual Studio solution with templates, Stimulsoft dlls and dataset
Attachments
TestIssue_new.zip
(3.04 MiB) Downloaded 164 times
User avatar
John
Posts: 128
Joined: Tue Feb 01, 2011 3:56 am
Location: England

Re: Table header "Print on: except first page" problem

Post by John »

Hello Lech,

did you have a chance to look into this issue.

Thanks in advance.

John K.
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Table header "Print on: except first page" problem

Post by Lech Kulikowski »

Hello,

You add additional reports as SubReports, in this case, the subreport is rendered as one page with unlimited height and then split into parts. Please try to add your subreports as pages in the main report.

Thank you.
User avatar
John
Posts: 128
Joined: Tue Feb 01, 2011 3:56 am
Location: England

Re: Table header "Print on: except first page" problem

Post by John »

Hello Lech,

thank-you for the information. I did not know that it is possible to add sub-reports in a different way than this:

Code: Select all

mainReport.SubReports.Add(template1);
You said, "add your subreports as pages in the main report". I tried this as follows:

Code: Select all

mainReport.Pages.AddRange(template1.Pages);
However, this gave me a null reference exception. Could you please tell me how this is done as I cannot find any information or example anywhere on it.

Many thanks

John K
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Table header "Print on: except first page" problem

Post by Lech Kulikowski »

Hello,

Please try to use the following code:
mainReport.SubReports.Add(template1, true, false);
mainReport.SubReports.Add(template2, true, false);

Thank you.
User avatar
John
Posts: 128
Joined: Tue Feb 01, 2011 3:56 am
Location: England

Re: Table header "Print on: except first page" problem

Post by John »

Hello,
I mentioned this in my first post - using mainReport.SubReports.Add(template1, true, false); as I had tried it already.
I know it resets the page numbering and the table headers display correctly but I had the problem that the page numbering I was displaying at the end of each page was then wrong. However, I have now found a different way to get the correct "Page x of y" for each page in the "EndRender" event so this is a good solution.

Thanks and regards,
John
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Table header "Print on: except first page" problem

Post by Lech Kulikowski »

Hello,

Also, in this case, please try to use the {PageNofMThrough} variable

Thank you.
Post Reply