Microsoft KB Archive/198426

{| = HOWTO: Control Spacing When Printing @...SAY's =
 * width="100%"|

ID: Q198426

The information in this article applies to:


 * Microsoft FoxPro for Windows, version 2.6a
 * Microsoft Visual FoxPro for Windows, versions 3.0, 3.0b, 5.0, 5.0a, 6.0
 * Microsoft Visual FoxPro for Macintosh, version 3.0b
 * Microsoft FoxPro for Macintosh, version 2.6a

SUMMARY
This article describes how to control the horizontal and vertical spacing of @...SAY commands when printed.

MORE INFORMATION
Although when printing an @...SAY, the coordinates are given to determine the location of the @...SAY on the printed page, the same coordinates can be in different locations depending on the font. You can use the SET PRINT FONT command to control the location of a given coordinate on a page. You should issue the SET PRINT FONT command after the SET DEVICE TO PRINTER command for it to effect the location of @...SAY coordinates. The following sample programs demonstrate this.

Run the following sample programs and note the difference in the printed output. The first sample program uses the SET PRINT FONT command to set the Print Font to Courier New, 12 point. The second program sets the Print Font to Courier New, 40 point.

Sample Program 1
xIsVFP=.F.  IF ! "2.6" $ VERSION     && The code in this IF is for VFP only. xIsVFP=.T.     _Screen.LockScreen = .T.      cOldbackcolor = _Screen.BackColor _Screen.BackColor = RGB(255,255,255) ENDIF

SET PRINTER TO  SET DEVICE TO PRINTER SET PRINT FONT "Courier New", 12

@ 1,1 SAY "Hello World" FONT "Arial",14 STYLE "B" @ 1,13 SAY "Goodbye World" FONT "Times New Roman", 12 STYLE "B" @ 5,1 SAY "Hello World" FONT "Arial", 10 @ 6,1 SAY "Goodbye World" FONT "Times New Roman",10 @ 7,1 SAY "No Font Clause"

SET DEVICE TO SCREEN SET PRINTER TO

IF xIsVFP _Screen.BackColor = cOldbackcolor _Screen.LockScreen = .F.  ENDIF

Sample Program 2
xIsVFP=.F.  IF ! "2.6" $ VERSION      && The code in this IF is for VFP only. xIsVFP=.T.     _Screen.LockScreen = .T.      cOldbackcolor = _Screen.BackColor _Screen.BackColor = RGB(255,255,255) ENDIF

SET PRINTER TO  SET DEVICE TO PRINTER SET PRINT FONT "Courier New", 40

@ 1,1 SAY "Hello World" FONT "Arial",14 STYLE "B" @ 1,13 SAY "Goodbye World" FONT "Times New Roman", 12 STYLE "B" @ 5,1 SAY "Hello World" FONT "Arial", 10 @ 6,1 SAY "Goodbye World" FONT "Times New Roman",10 @ 7,1 SAY "No Font Clause"

SET DEVICE TO SCREEN SET PRINTER TO

IF xIsVFP _Screen.BackColor = cOldbackcolor _Screen.LockScreen = .F.  ENDIF The SET PRINT FONT command also determines the font that @...SAY commands use if the FONT clause is not used on the @...SAY command. This is true whether you issue the SET PRINT FONT command either before or after the SET DEVICE TO PRINTER command. Only if you issue the SET PRINT FONT command after the SET DEVICE TO PRINTER command does it control the location of the @...SAY coordinates. NOTE: Microsoft has received unconfirmed customer reports that printer drivers can effect the spacing of @...SAY coordinates. If using the SET PRINT FONT command is not having the desired effect, try a different printer driver for your printer that is for a model that is similar or that your printer emulates.