Article ID: 242045 - Last Review: June 29, 2004 - Revision: 3.1 How To Control Line Spacing When Printing From Visual BasicThis article was previously published under Q242045 On This PageSUMMARY
The Printer object has no setting specifically for line spacing, but you can control the line spacing with the CurrentY property of the Printer object.
MORE INFORMATION
The print position on a page is determined by two properties of the Printer object, CurrentX and CurrentY, which control the X and Y coordinates respectively. Each time you call Printer.Print, the CurrentY position is incremented to advance to the next line. The amount of the increment is determined by the font and printer driver. So, to override the default line spacing you need to manipulate Printer.CurrentY directly. By default, this property uses twips and there are 1440 twips per logical inch. So for six lines per inch, you need each line to take 240 twips, and for eight lines per inch, you need 180 twips. You can set Printer.ScaleMode to use a different predefined scale or set the ScaleHeight and ScaleWidth properties to create a custom scale. It might also be useful to employ the TextHeight property to determine the minimum height for your text, and TextWidth to determine the width of your string. Please check Online Help and see the REFERENCES section below for more information on using these properties. The code below demonstrates the effect of changing the CurrentY property between lines. Note that you can cause lines to overlap without generating an error. Step-by-Step Example
REFERENCES
For additional information about manipulating print positions on a page, please click the article number below to view the article in the Microsoft Knowledge Base:
193943
(http://support.microsoft.com/kb/193943/EN-US/
)
How To Use GetDeviceCaps to Determine Margins on a Page
APPLIES TO
| Article Translations
|

Back to the top
