Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
POS printer
Message
 
 
To
18/04/2022 06:05:12
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Title:
Miscellaneous
Thread ID:
01684176
Message ID:
01684180
Views:
51
>Of course. I'm interested.
>
>>I have installed POS printer which is default printer. When I try to adjust some reports to print on A4 printer (modify report, file-page setup-print setup ...) and try to save, vfp crash. Any ideas?
>>
>>Thanks in advance.
>
>I don't know why your VFP crashes. But I have a couple of customers who need reports on A4 paper (European). So, I designed the report without saving the page size in VFP. Then, at run time, I change the report file (FRX) to print on A4 paper. If this is of interest to you, let me know, and I will post the code.
FUNCTION ConvertFrxToA4
LPARAMETERS tcReportFrx, cOrientation

LOCAL lcOrientation, lcExpression, lcTempAlias, lcExtName, oError

IF PCOUNT() < 2
	cOrientation = '0'    && Portrate
ENDIF 

lcExtName = ""

TRY 

	lcOrientation = cOrientation  &&  '0' && Portrate
	lcTempAlias = SYS(2015)
	*-- Set papersize and orientation.
	TEXT TO lcExpression TEXTMERGE NOSHOW
	ORIENTATION=<<lcOrientation>>
	PAPERSIZE=<<'9'>>
	COLOR=2
	ENDTEXT
			
	*-- Create a unique name for the report frx in the temp folder
	lcExtName = FORCEPATH( "RPT_" + TRANSFORM(_VFP.PROCESSID) + "_" + SUBSTR(SYS(2015),3,10), 
GETENV("temp"))
	*-- Copy the the report FRX and FRT files to the temp file name
	STRTOFILE(FILETOSTR(FORCEEXT(tcReportFrx, 'FRX')), m.lcExtName+".FRX")
	STRTOFILE(FILETOSTR(FORCEEXT(tcReportFrx, 'FRT')), m.lcExtName+".FRT")

	USE (m.lcExtName+".FRX") ALIAS (lcTempAlias) IN 0
	REPLACE Expr WITH m.lcExpression IN (lcTempAlias)

	USE IN SELECT(lcTempAlias)

CATCH TO oError

	m.lcExtName = ""
	
	MESSAGEBOX("Failed to convert report to A4 size paper" + CHR(13) + CHR(13) + ;
	"Error message: " + oError.message,48,"Problem Alert!",30000)
	
ENDTRY 

RETURN (m.lcExtName)
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform