Solved

set thecrystal printer report width and height using vb????

Posted on 2002-06-19
7
447 Views
Last Modified: 2012-05-04
Hi to all
can I change the width and length properties for a crystal report.
Ex: when I create the crystal file, I set the page setup to A4. but in some case I want to set it to Letter 8.5/11 inch, or a custom value.
can I change these property from code using vb??
and Is there any function to let the crystal choose the printer?? because by default it print on the default printer.. I know how to set the windows default printer using vb, but of course, it is better if I can choose the printer from crystal... and let the windows away :)
and thanks to all ...
0
Comment
Question by:omarmallat
  • 3
  • 3
7 Comments
 
LVL 3

Accepted Solution

by:
Elmo_ earned 100 total points
ID: 7092976
Omarmallat,

You can change all the settings you have mentioned here through vb.

I am adding in A description of each setting you should need with an example.

I have added in the Four settings you can use to change the Page setup:
   - MarginTop
   - MarginBottom
   - MarginLeft
   - MarginRight

I have also added in three ways to select the printer.  the best one to use is the PrinterName:
   - PrinterDriver (If you know the Pinter Drivers)
   - PrinterName (I think you should use this one)
   - PrinterPort (If you are using a local Printer)

If you have any more problems just post.

Cheers,

Ed.

------------------------------------------------------
MarginBottom

Description

Sets the bottom margin for the specified report.
Runtime Usage
[form.]CrystalReport.MarginBottom[=MarginSetting%]
For example:
CrystalReport1.MarginBottom = 720
      
+Sets a 1/2 inch bottom margin for the report (1 inch = 1440 twips);

Remarks
MarginSetting% is the margin you want, in twips.

Availability
Design time. Runtime


MarginLeft

Description

Sets the left margin for the specified report.
Runtime Usage
[form.]CrystalReport.MarginLeft[=MarginSetting%]
For example:
CrystalReport1.MarginLeft = 1440
      
+Sets a 1 inch left margin for the report (1 inch = 1440 twips);

Remarks
MarginSetting% is the margin you want, in twips.

Availability
Design time, Runtime)


MarginRight

Description

Sets the right margin for the specified report.
Runtime Usage
[form.]CrystalReport.MarginRight[=MarginSetting%]
For example:
CrystalReport1.MarginRight=1440
      
+Sets a 1 inch right margin for the report (1 inch = 1440 twips);

Remarks
MarginSetting% is the margin you want, in twips.

Availability
Design time, Runtime


MarginTop

Description

Sets the top margin for the specified report.
Runtime Usage
[form.]CrystalReport.MarginTop[=MarginSetting%]
For example:
CrystalReport1.MarginTop = 720
      
+Sets a 1/2 inch top margin for the report (1 inch = 1440 twips);

Remarks
MarginSetting% is the margin you want, in twips.

Availability
Design time, Runtime

----------------------------
'Selecting the printer

PrinterDriver

Description

Gets and sets the name of the printer driver that is to print the report.
Runtime Usage
[form.]CrystalReport.PrinterDriver[= DriverName$]
For example:
CrystalReport1.PrinterDriver = "Epson24.drv"
      
+Sets the printer driver to be the Epson 24 pin driver;

Remarks
The PrinterDriver, PrinterName, and PrinterPort properties work together to define the printer that the report is to be sent to. All three properties must be set in order to define a new printer. If all three properties are not set, the printer defined in the report will be used. This may be the users default printer if none has been specified in the report.

Availability
DesignTime, Runtime


PrinterName

Description

Gets and sets the name of the printer that is to print the report.
Runtime Usage
[form.]CrystalReport.PrinterName[= PrinterName$]
For example:
CrystalReport1.PrinterName= "Epson LQ-850"
      
+Specifies the Epson LQ-850 printer;

Remarks
The PrinterDriver, PrinterName, and PrinterPort properties work together to define the printer that the report is to be sent to. All three properties must be set in order to define a new printer. If all three properties are not set, the printer defined in the report will be used. This may be the users default printer if none has been specified in the report.

Availability
Design time, Runtime


PrinterPort

Description

Sets the port for the specified printer.
Runtime Usage
[form.]CrystalReport.PrinterPort[= PortName$]
For example:
CrystalReport1.PrinterPort= "LPT1"
      
+Sets the printer port to LPT1;

Remarks
The PrinterDriver, PrinterName, and PrinterPort properties work together to define the printer that the report is to be sent to. All three properties must be set in order to define a new printer. If all three properties are not set, the printer defined in the report will be used. This may be the users default printer if none has been specified in the report.

Availability
Design time, Runtime

0
 

Author Comment

by:omarmallat
ID: 7093408
thank you for your description, but I want to set the width and Length, not the top,bottom,left,right..

more description:
if the paper was not an A4, (example:attached paper, or role for a dot matrix printer) so If the length is not = length of the paper, a diffrence will appear in the second paper, and will increase or decrease after each paper.
now I have to change all the report file every time the paper size change. I want to get over this problem, if I can set the paper size, not the paper margin.. and sorry.
but for the pronter selection, it's very good.
0
 
LVL 3

Expert Comment

by:Elmo_
ID: 7095009
omarmallat,

The only thing that I can see to adjust the paper size is the Margin settings.  When you initially create your report you set it up as you wish it to look.  

I do not think that there are any commands in VB to allow you to change the paper size.  These are things that you have to select when you create your report.  

This could be to do with the limits of the printer. You may need to select a dot matrix printer so that you can create a report for that size paper.  (We only have A4 printers so that is the biggest page size that I have been able to select)

The only way to set the paper size that I can see is to do it manually through crystal reports (When creating your report) and this will allow you to increase the margin sizes within the pages limit.

Cheers,

Ed.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 100

Expert Comment

by:mlmcc
ID: 7096438
listening
0
 

Author Comment

by:omarmallat
ID: 7096549
are you sure that I will can not set the paper Width and Length?
Do I wait for any other comment? or you are sure???
0
 
LVL 3

Expert Comment

by:Elmo_
ID: 7098032
omarmallat,

I cannot see any other properties that would allow you to change the width or length of the of the report and I have checked all the properties that relate to the Crystal Report Control.

I am Fairly sure about this as I have checked it thoroughly and could find nothing.  It would also indicate to me that it is not possible as when you create your report You select the page size.  Crystal reports needs to have a printer driver installed on the computer when creating reports.  (If you don't you will get a notification email everytime you start crystal Report  designer) This is why my maximum page size is only A4.  If you had a larger printer, crystal reports may allow you to select a different paper size thenn allowing you to define larger margins.

Hope this helps,

Ed.
0
 

Author Comment

by:omarmallat
ID: 7099153
Thank you Elmo
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB error "Type mismatch" 2 61
Recommendation vb6 to vb.net or others 14 178
Macro Excel - Multiple If conditions 2 81
add criteria to query in VB, Access 2003 2 13
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…

820 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