Solved

Set Page Orientation using Crystal Reports in VB6

Posted on 2001-08-06
7
2,274 Views
Last Modified: 2012-06-27
Hi all,
I'm using VB6, with Crystal Reports version 4.6.
Is there a way to set the page orientation from the VB code?

The vb program is accessing SQL7.0 tables, then using the call

  crystal.action = 1

to open up the print preview screen.  The page orientation always comes up with whatever the orientation is for the user's default printer.
I've allowed the printer setup box to be available so the user can manually change the orientation, but I would like to have it automatically change to landscape, since the report is made in landscape style.

Any suggestions?
thanks
CraigEng
0
Comment
Question by:CraigEng
  • 3
  • 2
  • 2
7 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6357726
Have you tried setting the Printer Orientation property?
0
 

Author Comment

by:CraigEng
ID: 6357761
To acperkins,

I'm not sure where you mean to set this property.  I've been looking in the custom properties of the crystal reports control, but it doesn't have any orientation...
Do you mean to set it using something other than the crystal control?   I'm not sure how to do this (if that is what you meant...)

Thanks,
CraigEng
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6357904
My idea was for you to set the Orientation for the Printer object to see if that would change the default printer.  But it has been a while since I used Crystal reports and I have no idea if this works.
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 12

Expert Comment

by:DRRYAN3
ID: 6358023
See list of additional info at bottom.  You have to set both the CRW orientation and the printer orientation if you are printing directly to the printer.  This code sets the CRW orientation (there are other ways to do it depending on your version and technique)

Dim crpApp As CRPEAuto.Application
Dim crpReport As CRPEAuto.Report
Dim crpPageSetup As CRPEAuto.PageSetup

Set crpApp = CreateObject("Crystal.CRPE.Application")
Set crpReport = crpApp.OpenReport("C:\test\myreport.rpt")
Set crpPageSetup = crpReport.PageSetup

' Use any one of the following three constants to set the appropriate orientation

' crpPageSetup.PageOrientation = crDefauttPaperOrientation
' crpPageSetup.PageOrientation = crPortrait
' crpPageSetup.PageOrientation = crLandscape

These links may be helpful:

http://support.crystaldecisions.com/kbase/c2006136.asp?AJID=B48415DA8A0B6144B7E8C4A352DF0A3A
http://support.crystaldecisions.com/kbase/c2000383.asp?AJID=B48415DA8A0B6144B7E8C4A352DF0A3A
http://support.crystaldecisions.com/communityCS/FilesAndUpdates/wraptest.zip.asp?AJID=B48415DA8A0B6144B7E8C4A352DF0A3A
0
 

Author Comment

by:CraigEng
ID: 6403179
Thanks for the input DRRYAN3, (sorry to take so long to comment)

These solutions seem to be for Crystal Version 5 or higher.  I'm wondering if I'm missing something, since the installation from the VB6 disk only gives Crystal 4.6.  I looked on the Crystal site from the links you provided, but I wasn't able to see any way to upgrade.

I'm guessing the page orientation can't be set in Version 4.6.

Thanks,
CraigEng
0
 
LVL 12

Accepted Solution

by:
DRRYAN3 earned 200 total points
ID: 6406485
CraigEng

The upgrade is not free, but is well worth the money if you are doing any development work with CRW.  

If these properties are not available in your current version of Crystal Reports, you will most likely have to set the page orientation at report design time in the designer.  Not being familiar with CR 4.6, you may also find it necessary to set the properties for the default printer prior to printing.

DRRYAN3
0
 

Author Comment

by:CraigEng
ID: 6407485
Thanks for your input and time.
CraigEng
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now