Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
REPORT FORM Can't print on other printers
Message
 
 
To
11/12/2006 14:49:57
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01176637
Message ID:
01176667
Views:
12
AFAIK Yuri Rubinov posted it.

>A utility that was posted on the UT long ago. I no longer have any idea who originally posted it. Most have some form of this already (from using VFP8 and earlier versions):
>
>*--I added the color stuff - leave that out
>CLEAR
>LOCAL lcdefault, llokay, cleancolors
>lcdefault=UPPER(SYS(2003))
>cleancolors=.F.				&& false is do NOT change the colors on the report
>IF TYPE("pRepoForM")#"C"
>	LOCAL lcnewdefault
>	lcnewdefault=GETDIR()
>	IF !EMPTY(lcnewdefault)
>		SET DEFAULT TO (lcnewdefault)
>		pRepoForm="ALL"
>	ELSE
>		pRepoForm=GETFILE("frx")
>	ENDIF
>ENDIF
>
>DO CASE
>	CASE UPPER(pRepoForm)#"ALL"
>		pRepoForm=LOWER(pRepoForm)
>		IF NOT ".frx"$pRepoForm
>			pRepoForm=pRepoForm+".frx"
>		ENDIF
>		IF NOT FILE(pRepoForm)
>			pRepoForm=GETFILE("frx")
>			IF NOT ".frx"$pRepoForm
>				pRepoForm=pRepoForm+".frx"
>			ENDIF
>			IF NOT FILE(pRepoForm)
>				=MESSAGEBOX("Report Form "+pRepoForm +" not found?!")
>				RETURN
>			ENDIF
>		ENDIF
>		DO iClean WITH cleancolors
>	OTHERWISE
>		*WHAT ABOUT PAGE Orientation?
>		IF ADIR(aa,"*.frx")<=0
>			=MESSAGEBOX("No *.frx Report Forms found?!")
>			RETURN
>		ENDIF
>		FOR ia =1 TO ALEN(aa,1)
>			pRepoForm=aa[ia,1]
>			DO iClean WITH cleancolors
>		ENDFOR
>		IF ADIR(aa,"*.lbx")<=0
>			=MESSAGEBOX("No *.lbx Label Forms found?!")
>			RETURN
>		ENDIF
>		FOR ia =1 TO ALEN(aa,1)
>			pRepoForm=aa[ia,1]
>			DO iClean WITH cleancolors
>		ENDFOR
>
>ENDCASE
>llokay=IIF(UPPER(lcdefault)=UPPER(SYS(2003)),.T.,.F.)
>IF !llokay
>	SET DEFAULT TO (lcdefault)
>ENDIF
>RETURN
>*----------------------------------
>PROCEDURE iClean
>PARAMETERS cleancolors
>
>CLOSE TABLE ALL
>USE (pRepoForm)
>WAIT WIND "Fixing Report form "+DBF() NOWAIT
>=AFIELD(afld)
>* the very first record only
>IF ASCAN(afld,"TAG")#0 AND ASCAN(afld,"TAG2")#0 AND ASCAN(afld,"EXPR")#0
>	GO TOP
>	*keep orientation and number of copies
>	lcExpr1=""
>	lcExpr = "COPIES=1"
>	lcorient="ORIENTATION=0"
>	IF "orientation"$LOWER(EXPR)
>		lnOrientation = ATC("ORIENTATION", EXPR)
>		lcorient="ORIENTATION" + ;
>			SUBSTR(EXPR, ;
>			lnOrientation + 11, 02)
>	ENDIF
>	IF "copies"$LOWER(EXPR)
>		lcExpr=SUBSTR(EXPR,AT("copies=",LOWER(EXPR)),8)
>	ENDIF
>	lcExpr1=lcorient+CHR(13)+lcExpr+CHR(13)
>	REPLACE TAG WITH "", tag2 WITH "", EXPR WITH lcExpr1
>	? "*******************"
>	? EXPR
>ELSE
>	=MESSAGEBOX("File "+pRepoForm+". Not VFP6 format?!")
>ENDIF
>GO TOP
>SCAN
>	IF cleancolors	&& force lines and text boxes to black on white
>		*--Tracy runs this to cleanup vfp6 reports
>		DO CASE
>		CASE objtype=6	&& lines (-1=default color setting of desktop)
>			IF fillred=-1
>				REPLACE fillred WITH 255
>			ENDIF
>			IF fillgreen=-1
>				REPLACE fillgreen WITH 255
>			ENDIF
>			IF fillblue=-1
>				REPLACE fillblue WITH 255
>			ENDIF
>*!*				IF fillred=-1	&& background
>*!*					REPLACE fillred WITH 0
>*!*				ENDIF
>*!*				IF fillgreen=-1
>*!*					REPLACE fillgreen WITH 0
>*!*				ENDIF
>*!*				IF fillblue=-1
>*!*					REPLACE fillblue WITH 0
>*!*				ENDIF
>			IF penred=-1	&& forground
>				REPLACE penred WITH 0
>			ENDIF
>			IF pengreen=-1
>				REPLACE pengreen WITH 0
>			ENDIF
>			IF penblue=-1
>				REPLACE penblue WITH 0
>			ENDIF
>		CASE objtype=8 && fields
>			IF penred=-1
>				REPLACE penred WITH 0
>			ENDIF
>			IF pengreen=-1
>				REPLACE pengreen WITH 0
>			ENDIF
>			IF penblue=-1
>				REPLACE penblue WITH 0
>			ENDIF
>			IF fillred=-1
>				REPLACE fillred WITH 255
>			ENDIF
>			IF fillgreen=-1
>				REPLACE fillgreen WITH 255
>			ENDIF
>			IF fillblue=-1
>				REPLACE fillblue WITH 255
>			ENDIF
>		CASE objtype=7 && shapes
>		CASE objtype=5	&& text only
>			IF penred=-1
>				REPLACE penred WITH 0
>			ENDIF
>			IF pengreen=-1
>				REPLACE pengreen WITH 0
>			ENDIF
>			IF penblue=-1
>				REPLACE penblue WITH 0
>			ENDIF
>			IF fillred=-1
>				REPLACE fillred WITH 255
>			ENDIF
>			IF fillgreen=-1
>				REPLACE fillgreen WITH 255
>			ENDIF
>			IF fillblue=-1
>				REPLACE fillblue WITH 255
>			ENDIF
>		ENDCASE
>	ENDIF
>ENDSCAN
>USE
>gfile=LEFT(pRepoForm,RAT(".",pRepoForm)-1)+".*"
>?gfile
>RETURN
>
>
>
>
>
>>The problem is that the REPORT FORM wants a particular printer driver in the DEVICE NAME. I looked this up in the actual FRX file and you can see the following in the file:
>>
>>DRIVER=winspool
>>DEVICE=hp LaserJet 1300 PCL 6
>>
>>The above is found in the field EXPR of the REPORT FORM (.FRX file).
>>
>>How do you make this where it will go to any printer, rather than only locking in to one printer?
>>
>>I already changed it to "TO PRINTER" and it will not print unless I have the matching DEVICE NAME.
>>
>>Cecil
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform