Click here to Skip to main content
14,920,477 members
Articles / CrystalReports
Technical Blog
Posted 7 Aug 2012

Tagged as


3 bookmarked

Crystal Reports: Mixed Page Orientation Formatting

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
7 Aug 2012CPOL3 min read
Mixed page orientation formatting in Crystal Reports

I have not posted a blog about Crystal Reports for quite some time, so here is one! More Qlikview next week.

From Crystal Reports 2008 onwards, it is possible to develop a report with both Portrait and Landscape orientated pages and switch between the two as often as required in the same Report.

Setting this up in the Report is easy enough. It is applied on a Section by Section basis in the Section Expert, under the Page tab.

[At the time of writing, it is not possible to control Page Orientation through Formulas.]

So far, so good. But problems emerge regarding formatting when it comes to the Page Headers and Footers.

Let’s look at an example of mixed Orientation messing up a Report, then look at the methods we can use to fix it.

First, page one, a straight forward list of data which fits nicely into a Portrait Orientated Page:

Not the nicest Report, but far from the worst. It is clear and the Page Header and data fit on the Page.

However, if the Client wants a Chart on the second page in Landscape Orientation to give it as much room as possible:

The company name and address still looks ok, but the once centered, Title and right justified Logo and Date are now out of place.

When viewed in Design, the problem is much clearer:

All that grey in the top right of the Design view is where the Logo and Date Field should be when the page has Landscape Orientation.

Dealing with Text

If the only problem was the Text Fields, the solution is very simple. It is just a case of copying both the Title and Date Field, and placing the copies in the correct places for the Landscape page.

(I have changed the copy to a grey Font Color for clarity.)

First, the Title: by creating a copy and placing it centrally for the Landscape Page:

Then conditionally suppress the unwanted Title based on Page Orientation:

It is a very similar solution for the Date Field, but there are a couple of subtle differences.

Firstly, we cannot just place an object directly in that top right grey area. But we can extend the Date Field so it is just hanging onto the report:

There is a small bonus to this method, as only the Portrait Field needs suppressing on the Landscape Page. The Landscape Date is automatically hidden on the Portrait Pages.

This is all there is to handling the Field formatting for multi-Orientated Reports. Unfortunately, there are different rules for Graphics and other similar objects.

Dealing with Graphics

For reasons I do not understand, while moving a Field or Formula off the visible Page of a Report, it vanishes, but when the same is done with a Graphic, a second page is created to the right of the original page:

Even a suppressed Graphic will have the same effect on the report.

The way to resolve this is to create a new Page Section, duplicate everything in the original Page Header and make the whole thing dependent on the Page Orientation:

The only thing that still needs work is the Logo/Graphic.

A Graphic still cannot be placed wholly in the grey area, nor can it be stretched like the Date Field as it will warp the Graphic.

To get around this, the Graphic has to be extended with enough white space so it can be positioned correctly:

So, in Design view, the Report will look like this (I have added a border around the graphic for clarity):

The final report looks like this in Portrait:

And like this in Landscape:


All this may seem like excessive work for the sake of some formatted titles, but creating a report with consistent and professional formatting can be as important as the data itself for keeping the client happy.

We have only looked at the Page Header in this example, but obviously the same techniques can be applied to the Page Footer.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Scry Business Intelligence
United Kingdom United Kingdom
Jason Dove is a senior consultant at Scry Business Intelligence and instructor who has specialised in Crystal Reports and Business Intelligence his entire career, utilising it for everything, from selling paint to counter-terrorism. He has provided Business Intelligence consultancy for some of the world’s leading companies and is currently making the same service available to smaller businesses. He is also the author of 'Crystal Reports Formulas Explained', a step by step guide to creating and using formulas for the industry leading BI reporting software.

Comments and Discussions

QuestionCrystal Report Pin
Allseo12-Feb-15 3:49
MemberAllseo12-Feb-15 3:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.