Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP 6 Printer Settings in .frx
Message
De
04/05/2015 12:20:20
 
 
À
01/05/2015 09:48:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01619320
Message ID:
01619389
Vues:
60
>This must have been asked and answered many times before, but I can't find it.
>Is there any way to prevent VFP from saving printers settings in the .frx?
>I have a written a utility that removes them, but it would be nice if they weren't there.

It is wise to make the report readonly after a change and before using it. Of course, during development of the report you don't make it first RW then RO and so on constantly, so a routine to 'scrub' is handy. You wrote your own routine. Here is mine to scrub the report prior to making it readonly. I suggest it is named SCRUB.PRG.
*	Scrub a report.

* Changes:
*	05/jan/2009	pdv	

lparameter tcFile

Local oldSele, lcMsg, lcExpr, lcExpr1, lnOrientation
local lcFile, lnFnd
local array laFile[1]

do case
case pcount() = 0 or empty( m.tcFile ) or vartype( m.tcFile ) # 'C'
	*
	tcFile = GetParm()
	*
	if empty( m.tcFile )
		RETURN
	endif
endcase

lcFile = fullpath( m.tcFile )
lnFnd  = adir( laFile, m.lcFile )

do case
case m.lnFnd = 0
	*
	msgbox( "Report not found: " + m.lcFile )

case "R" $ laFile[ 1, 5 ]
	*
	msgbox( "Report is ReadOnly: " + m.lcFile )

otherwise

	oldSele = select()
	lcMsg   = ''

	Select 0

	Use ( m.lcFile ) ALIAS ReportFRX

	lcMsg = lcMsg + chr(13) + chr(9) + alltrim( m.lcFile )

	if isReadOnly()
		*
		lcMsg = lcMsg + ' (Failed: R/O)'
	else
		lcExpr1 = "COPIES=1"
		*
		scan for Objtype = 1		&& will imply one (DOS or WINDOWS) or two (DOS and WINDOWS) records 
			*
			lnOrientation = ATC("ORIENTATION", ReportFRX.Expr)
			*
			If lnOrientation > 0
				*
				lcExpr = lcExpr1 + ;
					chr(13) + ;
					"ORIENTATION" + ;
					SUBSTR(ReportFRX.Expr, ;
					lnOrientation + 11, 02 )
			else
				lcExpr = m.lcExpr1
			endif
			*
			replace ;
				ReportFRX.Expr WITH lcExpr, ;
				ReportFRX.TAG  WITH '', ;
				ReportFRX.TAG2 WITH ''

		endscan
	endif
	Use IN ReportFRX

	Select ( oldSele )

	msgbox( "Report file scrubbed: " + lcMsg )

endcase


FUNCTION msgbox( tcMsg )
	messagebox( m.tcMsg, 0+16, "Scrub Report", 5000 )
	RETURN

FUNCTION GetParm
	local lcInput, lnFnd, llRepDir
	
	if adir( laDir, "report", "D" ) = 1
		lnFnd    = adir( laFrx, "report\*.frx" )
		llRepDir = .t.
	else
		lnFnd = adir( laFrx, "*.frx" )
	endif
	
	lnFnd = adir( laFrx, "*.frx" )
	
	do case
	case m.lnFnd = 0
		lcInput = space( 50 )
	case m.lnFnd = 1
		lcInput = padr( laFrx[ 1, 1 ], 50 )
	otherwise
		lcInput = padr( ".frx", 50 )
	endcase

	define window GetParm from mrow(), mcol() to mrow() + 10, mcol() + 63 system noclose nogrow nozoom title "Specify report to scrub"
	move window GetParm center
	activate window GetParm
	@ 6, 3 say "Report:"
	@ 7, 3 get lcInput
	read
	if lastkey() = 27
		lcInput = ''
	endif
	release window GetParm
	activate window Command
	RETURN alltrim( m.lcInput )
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform