Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Change Printer
Message
From
27/02/2002 12:11:30
 
 
To
27/02/2002 10:44:29
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Miscellaneous
Thread ID:
00625774
Message ID:
00625831
Views:
15
Hi Agnes.

Now I want to set printer in front of report. I figured out that I need to set printer in front of first run because the settings will change the page (lenght)

How about using wscript.network? Just instantiate it in the init of your form like so:
WITH ThisForm
  *** Save the default printer
  .cDefaultprinter = SET( 'PRINTER', 2 )
  *** Set the combo up to point at the current default printer
  .cboPrinters.ListIndex = ASCAN( .cboPrinters.aContents, .cDefaultPrinter, -1, -1, 1, 15 )
  *** Create the WScript.Network object
  .oNet = CREATEOBJECT( 'WScript.Network' )
ENDWITH
You can populate a combo box with an array of available printers using code like this in the combo's init():
*** Get the installed printers into the combo box
APRINTERS( This.aContents )
This.Requery()
Then code like this in the combo's valid:


*** set the default printer to the selected printer
Thisform.oNet.SetDefaultPrinter( This.DisplayValue )


Al that is left is to reset the printer to the original default printer after you print the report.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform