Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to remove bad printinfo from expr field from report
Message
From
27/03/1998 20:30:17
 
 
To
27/03/1998 16:25:16
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00087827
Message ID:
00087863
Views:
33
>>expr field in first record of report for HPLJ 4L printer looks like:
>>
>>DRIVER=WINSPOOL
>>DEVICE=HP LaserJet 4L
>>OUTPUT=\\Marek\hp
>>ORIENTATION=0
>>PAPERSIZE=9
>>COPIES=1
>>DEFAULTSOURCE=1
>>PRINTQUALITY=300
>>YRESOLUTION=300
>>TTOPTION=2
>>
>>To print report properly, some lines of this info (DEFAULTSOURCE=)
>>must be removed,
>>otherwise when printing to some other printer, e.q. HPLJ 4P printer will try to select always incorrect (upper) tray!
>>But some lines (ORIENTATION=) must be remain untouched because they are set by report design!!
>>
>>Can somebody provide generic code to remove bad information from this
>>field? Some lines must be removed while some others not.
>>Can Tag and tag2 fields be blanked completely in first record?
>>Maybe to add this removing to genrepox?
>
>Tag,tag2 fields should be blanked completely. In Expr field delete driver/printer specific information (IMO, first three lines). I think it's better to do it manually.

Agree, Blank Tag, Tag2 is essential!!

If you sure which printer will be used in new system. You are better to use a
New property 'PrinterName' in form to hold the default printer!!

In FOrm designer, e.g. Thisform.PrinterName = "HP LaserJet 4L".
Then, when before printing, use the following code to load 1 time less on
printer driver!!
Lreport = "MyReport.frx"

* Ensure the printer name is selected
APRINTER(APR)  && Got current Printer Name

IF THISFORM.PRINTERNAME == "" OR EMPTY(ASCAN(APR, THISFORM.PRINTERNAME))
	* Ask the printername is really different from default printername!

	PR = GETPRINTER()
	THISFORM.PRINTERNAME = '&PR'
ELSE
	SET PRINTER TO NAME (THISFORM.PRINTERNAME)
ENDIF

* Print Action according to what option is selected!
PRINTOPT = THISFORM.OPTPRINT.VALUE

DO CASE
	CASE PRINTOPT = 1 && PRINT NOW
		REPORT FORM &LREPORT TO PRINTER NOCONSOLE

	CASE PRINTOPT = 2 && PRINT PREVIEW
		REPORT FORM &LREPORT PREVIEW

	CASE PRINTOPT = 3 && PRINT TO FILE AND VIEW IN FILE
		REPORT FORM &LREPORT TO ;
		FILE $TREPORT.TXT ASCII
		MODIFY COMMAND $TREPORT.TXT NOEDIT
		DELETE FILE $TREPORT.TXT
		WAIT IIF(FILE('$TREPORT.TXT'),'File not deleted','File deleted') WINDOW NOWAIT
ENDCASE
Of cos, it can be further enhance by using 'PRINTJOB... ENDPRINTJOB'.
But I have no time to study it... ~_~"
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Previous
Reply
Map
View

Click here to load this message in the networking platform