Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Crystal Reports ReportViewer alignment

Posted on 2009-07-12
11
Medium Priority
?
1,515 Views
1 Endorsement
Last Modified: 2013-12-17
I'm having problem with the ReportViewer control alignment.
If I change the paper orientation to portrait, the report will be shown in the center.
But if I change the paper orientation to landscape, the report will be shown on the top left.

Unfortunately, I need to display reports using both orientations. And this is not acceptable to the users.
While I know this is just cosmetics issue, but users insist on having it centered.
Does anybody know how to control the ReportViewer appearance?

Test project is attached. To open:
1. Unzip Envelope.zip
2. Rename WindowsApplication.txt to WindowsApplication.zip
3. Unzip WindowsApplication.zip

Portrait.PNG
Landscape.PNG
Envelope.zip
1
Comment
Question by:philipjonathan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 3
11 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24842068
I don't understand your comment, "If I change the paper orientation to portrait, the report will be shown in the center."  The report is still being shown from the left.  How are you changing the orientation?
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 24844770
A report is designed on the page.  Centering and other alignment is done to the fields based on the object they are in.

When you change a portrait report to landscape the width changes from 8.5 inches to 11 inches.
If the report is built for portrait then changing the orientation to landscape simply adds 2.5 inches of white space to the right of the report.

When do they change the orientation?
If it is in the report designer then simply change the left margin to 1.25 inches plus the margin set in the portrait report.  Set the right margin to the same value.

If they are trying to do this when they run the report through a viewing application, ther is no way to accomplish what you want without extensive coding in the application to set the paper size and margins.

mlmcc
0
 
LVL 18

Author Comment

by:philipjonathan
ID: 24845474
Hi all, thanks for replying.
What I mean is the position of the page relative to the ReportViewer control. As shown in the attached:
* For portrait, it is at the center of the ReportViewer
* For landscape, it is at the top left of the ReportViewer
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 96

Accepted Solution

by:
Bob Learned earned 1000 total points
ID: 24849275
Aah, the entire page, not the report output (gotcha!!).

I don't believe that you have any control over that positioning, but some magic might be possible.
0
 
LVL 18

Author Comment

by:philipjonathan
ID: 24855903
and that magic is .... ?  :)
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 24858402
"might" means that I can't dismiss that something is possible, but also suggests that I have no idea...
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 24861699
The only way  I can think of is to change the margins of the page on the fly so if you choose portrait they will be .5" and in landscape 1.75"

I am not sure if you can change the margins on th efly  that way or not.

What version  of Crystal?

How are you running the reports?

mlmcc
0
 
LVL 18

Author Comment

by:philipjonathan
ID: 24867826
mlmcc, how do I change the margins?

>What version  of Crystal?
I couldn't find the Crystal Reports version anywhere, it only says:
"Crystal Reports for Visual Studio 2005"

>How are you running the reports?
I run create the ReportViewer control and sets the ReportSource to the ReportClass object during Form.Load event.
The ReportClass itself gets the data from Excel file.
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 1000 total points
ID: 24891868
I don't think in that version you can control the margins from code.

You may need to create a landscape version then in the code open the one they want.

mlmcc
0
 
LVL 18

Author Comment

by:philipjonathan
ID: 24891877
mlmcc, thanks again. Just to clarify, my problem is the report page being shown on top left of the ReportViewer when I use landscape mode, doesn't matter if I set the page size (& margin) at design-time or run-time. After trying with the margin, it doesn't solve my problem.
I seems that there is no viable options.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 24891917
When you say it doesn't work to set the margins.  Are you looking to center both vertically and horizontally?

mlmcc
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question