Pages Portrait and Lanscape

Stimulsoft Reports.NET discussion
Post Reply
Leandro Borges
Posts: 219
Joined: Tue Oct 27, 2015 4:19 pm

Pages Portrait and Lanscape

Post by Leandro Borges »

Hello.

In my report I have two pages, one in portrait orientation and the other in landscape orientation. The page in portrait orientation must print the page in landscape orientation at any given time, and then reprint the page in portrait orientation.
Is it possible to make these orientation changes? How do I print the page in landscape orientation and then the page in portrait orientation?

Thank you.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Pages Portrait and Lanscape

Post by Edward »

Hi Leandro,

There are 2 approaches I can see to solve the task, depending on the number of pages you need to print. The first approach below will print 2 pages and the second - 4 pages.

1) You could change the layout of that page to be the landscape orientation from the code of the report. Please check the attached report. The page has got AfterPrint event handler set to the following code:

Code: Select all

Page1.Orientation = Stimulsoft.Report.Components.StiPageOrientation.Landscape; 
Please check the attached report template
PortraitToLandscape.mrt
(4.04 KiB) Downloaded 337 times
2) If the page needs to be printed twice in portrait, and then in landscape orientation, then in the designer please right-click the 'Page1' page tab and select 'Duplicate' in the context menu. The Page1 will be duplicated as Page2 with all the components. Now you could change the orientation of the second page to be Landscape. But in that scenario, 4 pages will be obviously printed, not 2.

Thank you,
Edward
Leandro Borges
Posts: 219
Joined: Tue Oct 27, 2015 4:19 pm

Re: Pages Portrait and Lanscape

Post by Leandro Borges »

Hello.

Did not work. I'll explain it another way.
In my report I have page 1 with portrait orientation and page 2 with landscape orientation.
On page 1 there is a group band and in the before print, I need to check whether or not to print page 2.
I tried typing the following code in the before print to print page 2 but it did not work:
this.RenderedPages.Add (this.Pages ["Page2"]);
Is something missing that I have not done?

Thank you.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Pages Portrait and Lanscape

Post by Edward »

Hi Leandro,

You are correct, it looks like a little bit of misunderstanding is going on here.
Could you please confirm that the layout of the report stays unchanged, I mean the number of rows per page. But you need just to change the page orientation after the report has been rendered?

Thank you,
Edward
Leandro Borges
Posts: 219
Joined: Tue Oct 27, 2015 4:19 pm

Re: Pages Portrait and Lanscape

Post by Leandro Borges »

Hello Edward.

The Page 2 that is in landscape orientation has many records that do not fit in portrait orientation. So I chose to create two pages, one in portrait orientation and one in landscape orientation. At a certain time, the page one that is in portrait orientation should stop printing. To print the page two that is in the landscape orientation and after printing it, should go back to page one.
Why did not the command below work? Something is missing?

this.RenderedPages. Add(this.Pages ["Page2"]);

Thank you.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Pages Portrait and Lanscape

Post by Edward »

Hi Leandro,

Please check the following topic, if you would like to join some external reports together in one report if I understand correctly your idea with RenderedPages collection: viewtopic.php?t=1699

In case of 2 pages in the report template, let's say Page1 and Page2, then the report engine will render all the rows for Page1 and then will start rendering all the rows for the Page2. I do not think that this is the scenario you would like to see.

So the simplest possible solution would be to manipulate with the same Page1 in the report template only. Let's say you would need to change the Page1 orientation 'on the fly' if you need to swap the page orientation from Portrait to Landscape and then back. Please check the attached report template. There are 2 events in the report template - 1 event for the Page1.AfterPrint:

Code: Select all

if (Page1.Orientation == Stimulsoft.Report.Components.StiPageOrientation.Portrait)
{
	Page1.Orientation = Stimulsoft.Report.Components.StiPageOrientation.Landscape;
}
else
{
	Page1.Orientation = Stimulsoft.Report.Components.StiPageOrientation.Portrait;
}
And another for Report.BeginRender:

Code: Select all

Page1.Orientation = Stimulsoft.Report.Components.StiPageOrientation.Portrait;
ChangePageOrientation-Page-AfterPrintEvent.mrt
(790.36 KiB) Downloaded 363 times
I hope that helps. If not, please attach a report with simple data in this topic, or please send it, alternatively, to support[at]stimulsoft.com, we will try to solve the problem you are facing or to suggest an easier workaround if things get complicated.

Thank you,
Edward
Leandro Borges
Posts: 219
Joined: Tue Oct 27, 2015 4:19 pm

Re: Pages Portrait and Lanscape

Post by Leandro Borges »

Hello.

Ok.

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

Re: Pages Portrait and Lanscape

Post by Lech Kulikowski »

Hello

Please let us know if you need any additional help.

Thank you.
Post Reply