Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Print report to a different printer
Message
From
25/10/2005 15:33:07
 
 
To
25/10/2005 15:30:14
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01060044
Message ID:
01062009
Views:
25
HTH
* Courtesy Yuri Rubinov July 2000 Universal Thread
* Remove printer specific setting in report form
*---------------------------------------------------

PARAMETER pRepoForm
CLEAR
LOCAL lcdefault, llokay, cleancolors
lcdefault=UPPER(SYS(2003))
cleancolors=.F.	&& false is do NOT change the colors
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
		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
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform