Microsoft KB Archive/99542

= Printing Reports Created w/ Question Marks in FP for Win =

Article ID: 99542

Article Last Modified on 12/1/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 6.0 Professional Edition
 * Microsoft FoxPro 2.5b
 * Microsoft FoxPro 2.5a
 * Microsoft Visual FoxPro 3.0b for Macintosh

-



This article was previously published under Q99542



You may have reports (commonly xBASE-programmed) that used to print correctly but now do not align properly. This problem may occur because of the use of proportional fonts in Windows.

The following two methods allow FoxPro for Windows to print reports that are created using ? commands and also send escape codes to the printer.

Method If You Previously Used FoxPro for MS-DOS
NOTE: For the following method to work correctly, you must have had FoxPro 2.0 or 2.5 for MS-DOS previously installed and have an existing 2.0 or 2.5 printer driver in the current resource file. Loading the printer driver provides hooks into the GENPD.APP program, which is used for MS-DOS-style printing. The GENPD.APP program is not available with Visual FoxPro.


 * 1) Turn off all open print commands by issuing SET DEVICE TO SCREEN and SET PRINTER TO commands.
 * 2) Load an existing FoxPro for MS-DOS version 2.0 or 2.5 printer driver that is in the current resource file. The sample program below uses an existing printer driver named HPCOMPRESS. This printer driver opens the printer in &quot;raw mode,&quot; which bypasses the Windows printer drivers.
 * 3) Issue a SET PRINT ON command, which redirects any question mark (?) output to the printer.
 * 4) At the end of the report code, issue a SET PRINTER TO command to clear the raw mode and begin using Windows printer drivers again.

The following code illustrates the above steps: SET DEVICE TO SCREEN SET PRINTER TO  SET PDSETUP TO &quot;hpcompress&quot; SET PRINT ON  ? _pdparms(15)    && This is an example of using _PDPARMs and && escape codes to control printing attributes. && This is for turning italics on.

?&quot;Hello&quot; ? chr(27)+&quot;(s16.66H&quot; && This is an example of sending a control                       && sequence directly.   ?&quot;There&quot;   EJECT   SET PRINTER TO   SET LIBRARY TO   SET PDSETUP TO

Method If You Use Only FoxPro for Windows or Visual FoxPro for Windows
If you do not have access to FoxPro for MS-DOS and its drivers, you can accomplish the same result by doing either of the following:


 * Setting the Windows output to Generic/Text only.

-or-
 * Selecting one of the monospace (nonproportional) fonts (such as Courier, FoxFont, or FoxPrint) by issuing the SET PRINT FONT &quot; &quot;,10 command. This method is also valid for reports being to Visual FoxPro for Macintosh.

Additional query words: vFoxMac VFoxWin FoxWin 2.50 pdparms FOXPROW kbvfp300 kbvfp600

Keywords: KB99542

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.