Microsoft KB Archive/38345

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Converting Control Code Characters

PSS ID Number: Q38345 Article last modified on 11-02-1994

3.x 4.00 5.00

MS-DOS

SUMMARY

If a printer control code has a decimal value less than 32, it must be converted to a format that Word can recognize. To convert the code, do the following:

  1. Add 64 to the decimal value for the character.

  2. Look up the sum in an ASCII table and use that character. For example, ESC is a decimal 27, so add 64 to 27 (64+27=91), then use the character at decimal 91 ([) in its place. For example, the control character for ESC is as follows:

    ^[ (caret-left bracket)

MORE INFORMATION

If the control code to be sent to the printer has a value greater than 31, the code doesn’t need to be preceded with a caret.

However, if the control code is between 128 and 159, it must be converted to octal representation. The octal-control sequence starts with a caret followed by zero and the three-digit octal value for the character. To make an octal control-character sequence, do the following:

  1. Start with a ^0 (caret-zero).

  2. Follow the ^0 with the octal number and a space. For example, decimal 150 = Octal 226; therefore, you would send the following control code:

    ^0226

KBCategory: kbother KBSubcategory: Additional reference words:

============================================================================= Copyright Microsoft Corporation 1994.