Problem with databand on report with differing page margins

Stimulsoft Reports.WEB discussion
n.froeh
Posts: 17
Joined: Mon Oct 05, 2020 6:03 am

Problem with databand on report with differing page margins

Post 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
pos.PNG (11.34 KiB) Viewed 4103 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.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Problem with databand on report with differing page margins

Post by Lech Kulikowski »

Hello,

Please send us a sample project that reproduces the issue for analysis.

Thank you.
n.froeh
Posts: 17
Joined: Mon Oct 05, 2020 6:03 am

Re: Problem with databand on report with differing page margins

Post 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
Stimulsoftissue.PNG (26.58 KiB) Viewed 4072 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,
TwoSimpleLists.mrt
(291.94 KiB) Downloaded 159 times
) and dynamic page margin setting when deliviering the report (
ViewerController.cs
(1.67 KiB) Downloaded 165 times
). I added these two edited files seperately and the complete project as .zip file (
StimulsoftIssue.zip
(2.12 MiB) Downloaded 177 times
). I used Version 2020.5.2.

I hope you can help me with that and thank you!
Attachments
Stimulsoftissue.PNG
Stimulsoftissue.PNG (26.58 KiB) Viewed 4073 times
ViewerController.cs
(1.67 KiB) Downloaded 159 times
TwoSimpleLists.mrt
(291.94 KiB) Downloaded 168 times
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Problem with databand on report with differing page margins

Post by Lech Kulikowski »

Hello,

We need some additional time to investigate the issue, we will let you know about the result.

Thank you.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Problem with databand on report with differing page margins

Post by Lech Kulikowski »

Hello,

Please check the modified code in the attachment.

Thank you.
Attachments
ViewerController.cs
(2.28 KiB) Downloaded 171 times
n.froeh
Posts: 17
Joined: Mon Oct 05, 2020 6:03 am

Re: Problem with databand on report with differing page margins

Post 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.
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Problem with databand on report with differing page margins

Post by Lech Kulikowski »

Hello,

Unfortunately, we can not fix it due to some features of the engine.

Thank you.
n.froeh
Posts: 17
Joined: Mon Oct 05, 2020 6:03 am

Re: Problem with databand on report with differing page margins

Post 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
DesignerCorrect.PNG (16.03 KiB) Viewed 3842 times
The last line is missing in the exported pdf:
PDFIncorrect.PNG
PDFIncorrect.PNG (9.94 KiB) Viewed 3842 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.
Attachments
ViewerController.cs
(2.26 KiB) Downloaded 152 times
PdfCutOffIssue.mrt
(5.28 KiB) Downloaded 161 times
PdfCutOffIssue.json
(453 Bytes) Downloaded 147 times
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Problem with databand on report with differing page margins

Post by Lech Kulikowski »

Hello,

We couldn't reproduce the issue.
Please try to check the last release build.

Thank you.
Attachments
Screenshot 2021-03-16 215037.jpg
Screenshot 2021-03-16 215037.jpg (130.9 KiB) Viewed 3806 times
n.froeh
Posts: 17
Joined: Mon Oct 05, 2020 6:03 am

Re: Problem with databand on report with differing page margins

Post 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.
Post Reply