I often find it neat and helpful to paste syntax-highlighted code listings to my documents and email communications. In addition to the aesthetics, the syntax highlighting allows for more readable code. Of the many powerful text editors out there, PSPad provides a feature for generating syntax-highlighted rich text.

Setup

  1. Download and install the latest version of PSPad from http://www.pspad.com
  2. Save the file PeopleCode.INI below into the Syntax folder inside PSPad install location. By default, this would be C:\Program Files\PSPad editor\Syntax\.
  3. Launch PSPad and from the menu select Settings > Highlighters Settings…
    Highlighter Settings menu
  4. On the left pane, select and put a checkmark on the first <not assigned> item.
    Highlighter Settings
  5. Then on the User Highlighters list on the right pane, select PeopleCode.
    Highlighter Settings
  6. Go to the Colors tab. Here the color preferences to be used for syntax highlighting is set. To match the way the PeopleCode editor does highlighting, choose green for the comment; blue for Key, Key words 2, Key words 3 and Reserved Word; and red for String.
    Highlighter Settings colors

Usage

  1. Create a new document, from the menu File > New file… or using the following button:
    New PeopleCode file
  2. Paste the PeopleCode to the document:
    PeopleCode Syntax Highlighted
  3. Select the text you want to copy. From the menu select File > Export > Export to Clipboard as RTF:
    Export to RTF
  4. Now, you can paste to an Office document and the formatting would be preserved.

 

Files

PeopleCode.INI

For SQR users, here’s a SQR.INI syntax file for PSPad.