Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Set printer to name not responding in program
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00676851
Message ID:
00676869
Vues:
24
This message has been marked as the solution to the initial question of the thread.
Did you use the default printer when you created the report? If you did not specify any printer, than the default printer's information is stored in the report. Try removing this information with something similar to the below code by Yuri Rubinov (it's what I use). Then recompile your app after the printer specific information has been stripped out of the reports:
* Yuri Rubinov July 2000
* Modified by Tracy C Holzer to allow for selecting entire directory
*                            or a specific frx file
* Remove printer specific setting in report form
*---------------------------------------------------

PARAMETER pRepoForm
CLEAR
LOCAL lcdefault, llokay
lcDefault=UPPER(SYS(2003))

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
	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
		ENDFOR

ENDCASE
llokay=IIF(UPPER(lcdefault)=UPPER(sys(2003)),.t.,.f.)
IF !llokay
    SET DEFAULT TO (lcdefault)
ENDIF
RETURN
*----------------------------------
PROCEDURE iClean

	CLOSE TABLE ALL
	USE (pRepoForm)
	WAIT WIND TIME 0.5 "Fixing Report form "+DBF()
	=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

	USE
RETURN
>I have an unusual problem, that I am puzzled by.
>I have some simple reports I created in the foxxpro report designer and I run them using a selection form that gives options. The form has color boxes that print depending on the data, so I want to be able to send it to the color laser on the network.
>
>If I issue a Report Form umptysquat for record nrec to printer prompt nowait I get the select printer prompt and it all workd fine.
>
>But if I leave out the prompt it goes to the windows default printer (not the color one) each and every time.
>
>I am trying to make a set printer command button work by running cprinter = getprinter() and then doing a SET PRINTER TO NAME (cprinter). Then when I issue the report form command without the prompt it seems to ignore the set printer to command.
>
>It gets worse. I can issue the set printer to name (cprinter) from the command window and it works. But the same comand in the click event of the print button on my form doesn't do it.
>
>SET("PRINTER",2) returns the default windows printer, and
>SET("PRINTER"),3) returns the default Foxpro printer. But it seems to always be defaulting to the windows printer and not the one I set with Foxpro.
>
>Anyone seen this before and have any ideas.
>
>Any help would be pperciated. TIA
.·*´¨)
.·`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"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform