2121
FAQ [Reports]
On this page are placed the answers to questions which I cruelly (or easy) found, I do not think, that the answers are exhausting, and if you will find, that something not conform to your representations, let's discuss and we shall find the best decisions... Besides frequently answer can depend on the version as OS and Visual FoxPro, to check up all on all versions and platforms for me simply excessively. Initially this list was only for VFP 5.0, while now it only VFP 7.0/8.0, I could somewhere and miss a mention of the version, and if you will find discrepancies, inform me, please.

а

Q: Whether it is possible from the report received by means of creation of the report in Visual FoxPro to receive "the full-function textual document" (fonts, etc.)?а

A: Directly is not present. By means of the report it is possible to receive only textual document (option ANSI in a command REPORT). If it is necessary to you to receive "the full-function document" any of a product, for example Word, you should use the OLE-mechanism just of this product for registration of the results from Visual FoxPro.

Q: Whether there is a possibility automatically to maximize the preview window of the report?а

A: Try to do:
#DEFINE WND_PRVREP "Report"
IF WEXIST(WND_PRVREP)
    ZOOM WINDOW (WND_PRVREP) MAX
ENDIF
in event MyReport.DataEnvironment.Init(). Pay attention, that it will not work in Application, constructed by the means Application Wizard in VFP 6.0, however there and there are no these problems.

Q: I wish to print a text file from VFP, but it is impossible to me something do it :-( It can somehow be made?а

A: Try to do similarly to the following:
#DEFINE C_FILENAME	"D:\MyApp\Vfp\Picture.prg"
#DEFINE C_OUT_PORT	"\\Server\Printer1"
*
******************* Or:
*#DEFINE C_OUT_PORT	"PRN:"  &&<- default
*#DEFINE C_OUT_PORT	"LPT1:" &&<- LPT1
******************* 
*
DECLARE INTEGER CopyFile IN KERNEL32.DLL ;
	STRING lpExistingFileName,; && name of an existing file
	STRING lpNewFileName,;      && name of new file
	INTEGER bFailIfExists       && operation if file exists

LOCAL lbRetVal
IF CopyFile(C_FILENAME, C_OUT_PORT, 0) = 0
	ACTIVATE SCREEN
	?CHR(7)
	=MessageBox('Can not print file', 16, _SCREEN.Caption)
ELSE
	lbRetVal = .T.	
	WAIT WINDOW 'Ok!' NOWAIT
ENDIF
CLEAR DLLS
RETURN lbRetVal

Q: On REPORT FORM... TO PRINTER I receive an error: 1958 Error loading printer driver. How to overcome it?а

A:
- In Report designe choice from menu item: File - > Page Setup, Print Setup..., OK, OK.
- See also article "HOWTO: Control Printer Attributes for a Report at Run Time" in MSDN
- at last try do next:
USE Myreport.frx  && Open the FRX as a table
LOCATE FOR Objtype = 1 AND Objcode = 53  && find the record that holds
** the printer information. For more information on the Table Structure
** of an .FRX file, see 'Table Structures of Table Files' in Help.
REPLACE Tag WITH ""  && Remove any Printer codes that may be stored in
** the Tag memo
REPLACE Tag2 WITH ""  && Remove any Printer codes that may be stored in
** the Tag2 memo

Q: There is a desire to print out lines from VFP but I can not understand, how it can be made. Is it possible?а

A: Try to look Q255744 section "HOWTO: Obtain a Device Context Handle for a Print Device" in MSDN

Q: Cannot quit Visual FoxPro when previewing report. How to overcome?а

A: See in MSDN:
Q179605 PRB: Cannot Quit Visual FoxPro When Previewing Report in a DESKTOP Window
Q156237 PRB: Report Designer/Preview Needs VFP Desktop to Display
Q190069 HOWTO: Showing Print Preview as MDI Child of Top-Level Form
Q188887 HOWTO: How to Display Print Preview in a Top-Level Form

Q: Whether it is possible to choose the printer at printing of the VFP-report?а

A: Try do commands:
REPORT ... to printer PROMPT
SET PRINTER ON PROMPT
See also: SYS(1037), GETPRINTER(), APRINTERS(), ...
а
а
Hosted by uCoz