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

x
?
Solved

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

Posted on 2002-06-19
7
Medium Priority
?
476 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
[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
  • 3
  • 3
7 Comments
 
LVL 3

Accepted Solution

by:
Elmo_ earned 300 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 101

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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

636 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