Microsoft KB Archive/71235

= Telling QB to Wrap (Not Truncate) Wide Lines on HP LaserJet =

Article ID: 71235

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1
 * Microsoft QuickBasic 3.0
 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b

-



This article was previously published under Q71235



SUMMARY
When printing program listings to a Hewlett-Packard (HP) LaserJet II from the ALT+File+Print menu option in QB.EXE or QBX.EXE, long lines exceeding 80 columns will be truncated to 80 columns rather than wrapped to the next line. This is due to the default no-wrap mode of the HP LaserJet II series, and can be changed by sending the appropriate escape code to the printer (as described below).

This information applies to Microsoft QuickBasic versions 4.00, 4.00b, and 4.50; to Microsoft Basic Compiler versions 6.00 and 6.00b; and to Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10.



MORE INFORMATION
Because QB.EXE and QBX.EXE make no assumptions about the printer type or page layout, long print lines are sent to the printer as they are, with no pre-formatting. This can be a problem if a particular printer has no provisions for wrapping long lines. Fortunately, most printers have either a DIP switch setting for line wrapping or, more often, an escape code that can be sent to the printer to enable or disable line wrapping.

With the Hewlett-Packard LaserJet II series, the code sequence to enable line wrapping is ESC+&quot;&s0C&quot;, where ESC is the byte value returned by the CHR$(27) function, and the quotation marks are not part of the sequence. The code sequence to disable line wrapping is: ESC+&quot;&s1C&quot; For other laser printers, please refer to the printer's manual for appropriate control codes.

The following sample programs will enable and disable line wrapping on the HP LaserJet II series printers:

Sample Program
REM This program enables line wrapping on HP LaserJet printers. REM You can run this program before printing a program listing that REM has lines wider than 80 characters. OPEN &quot;LPT1:&quot; FOR OUTPUT AS #1 PRINT #1, CHR$(27); &quot;&s0C&quot;; CLOSE #1 END REM This program disables line wrapping on HP LaserJet printers. OPEN &quot;LPT1:&quot; FOR OUTPUT AS #1 PRINT #1, CHR$(27); &quot;&s1C&quot;; CLOSE #1 END

Additional query words: QuickBas BasicCom

Keywords: KB71235

-

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

© Microsoft Corporation. All rights reserved.