Page 1 of 3
Problem with databand on report with differing page margins
Posted: Mon Jan 11, 2021 8:40 am
by n.froeh
Hey there,
we got a problem with the position of the entries of a databand on pages with different page margins.
Given is a report with one page with a data band and header on it. Furthermore in the Page Rendering-Event the setting of the page margins is defined by C#-Code (RenderSide(object? sender, EventArgs e)):
Code: Select all
var side = sender as StiPage;
if (!(side is null))
{
var isFirstSide = side.Report.PageNumber == 1;
side.Margins = new StiMargins(
isFirstSide ? 2.5 : 2.5,
isFirstSide ? 2 : 0,
1,
0);
}
The databand has as much data that multiple rendered pages are produced from the single page. The suceeding page has a different page margin like the first page on the right side.
What i expect is that the page margin is set correctly for all pages.
What happens is that the page margins are set correctly for all pages.
Only the first entry of the databand on the suceeding pages is formatted incorrectly (it still uses the same page margin as the first side, so it is placed 2,5 on the left).
Example picture of suceeding page:

- pos.PNG (11.34 KiB) Viewed 5745 times
This is the databand on a suceeding page. As you see the second entry (34) is placed correctly with no right margin. The first entry (33) is placed wrong with the margin of the first page, although it is on the suceeding page.
So my question is:
Why is the first entry on the suceeding pages rendered differently from the others and is there any fix for this?
Thank you for your time and your help.
Re: Problem with databand on report with differing page margins
Posted: Fri Jan 15, 2021 12:17 pm
by Lech Kulikowski
Hello,
Please send us a sample project that reproduces the issue for analysis.
Thank you.
Re: Problem with databand on report with differing page margins
Posted: Mon Jan 18, 2021 7:39 am
by n.froeh
Hello,
i provided an example with the attachments.
The problem is the first row of databand1 of the second page, which has the wrong page margin.

- Stimulsoftissue.PNG (26.58 KiB) Viewed 5714 times
It's the basic Show Report in the Viewer example with the modified report (added dockstyles in the databand, theses are needed that our report takes the complete space with dynamic page margins,
) and dynamic page margin setting when deliviering the report (
). I added these two edited files seperately and the complete project as .zip file (
). I used Version 2020.5.2.
I hope you can help me with that and thank you!
Re: Problem with databand on report with differing page margins
Posted: Mon Jan 18, 2021 11:58 pm
by Lech Kulikowski
Hello,
We need some additional time to investigate the issue, we will let you know about the result.
Thank you.
Re: Problem with databand on report with differing page margins
Posted: Tue Jan 19, 2021 2:08 pm
by Lech Kulikowski
Hello,
Please check the modified code in the attachment.
Thank you.
Re: Problem with databand on report with differing page margins
Posted: Wed Jan 20, 2021 11:52 am
by n.froeh
Hello,
thank you for your fast help. The workaround works as intended.
Is this behaviour working as intendent or will you fix this in a future version?
Thank you.
Re: Problem with databand on report with differing page margins
Posted: Wed Jan 20, 2021 2:57 pm
by Lech Kulikowski
Hello,
Unfortunately, we can not fix it due to some features of the engine.
Thank you.
Re: Problem with databand on report with differing page margins
Posted: Thu Mar 11, 2021 11:13 am
by n.froeh
Hello,
thank you for your help with the last issue we had.
We have one more problem with dynamic page margins and the rendering event.
We use the viewer controller with the dynamic page margin like in the previous example with a bigger left and right margin (see ViewerController.cs).
We have a report with a databand with different fields, some are docking to the right (field3), some are docking to the left (field1) and one big field is filling the remaining space in the middle of the databand (field2). (see Report PdfCutOffIssue.mrt with data PdfCutOffIssue.json)
The problem is that the
exported pdf cuts off the text of our "field2", although it is displayed correctly in the viewer.
The text is displayed correctly in the viewer:

- DesignerCorrect.PNG (16.03 KiB) Viewed 5484 times
The last line is missing in the exported pdf:

- PDFIncorrect.PNG (9.94 KiB) Viewed 5484 times
I tested some things and found out, that the problem relies on the dynamic page margins and the dock styles, but could not find a solution.
Is there a fix for this issue?
Thank you for your help and i'm looking forward to an answer.
Re: Problem with databand on report with differing page margins
Posted: Tue Mar 16, 2021 8:52 pm
by Lech Kulikowski
Hello,
We couldn't reproduce the issue.
Please try to check the last release build.
Thank you.
Re: Problem with databand on report with differing page margins
Posted: Mon Mar 22, 2021 8:09 am
by n.froeh
Hello,
thank you for your fast answer.
I checked the latest build and saw that the page rendering event (Line 36/37 of ViewerController) is not triggered by "report.render()" (Line 59 of ViewerController) anymore, that's why the page margins are not set dynamically on your screenshots and you could not reproduce the issue. In conclusion the dynamic page margins are not working anymore on the latest Stimulsoft Version (in my current example).
I can invoke the different events by myself, but the dynamic page margins are not set on the output report of the viewer. So that does not help, too.
Why are the events on rendering not triggered anymore and how can i set the page margins for the report dynamically while rendering with the newest version now (2021.2.1, i used 2020.5.2 previously)?
Thank you.