# Save Unit Dialogue Box

This dialogue box is displayed when the File | Save Unit menu option is clicked. It is used to specify the file name, file type and formatting information for the unit that is to be saved.

All currently selected snippets, with the exception of any freeform snippets, are included in the generated unit. (See the Search Database task for information on how to select the required snippets).

The dialogue is a standard Windows save dialogue box with a few added options.

You specify the name and folder for the file where the unit will be saved in in the usual way. Warning: the chosen file name, minus its extension must be a valid Pascal unit name.

Use the Save as type drop down list to specify the type of file to be saved. Options are:

- A Pascal unit file (.pas) – The code is written to a file with extension .pas. The unit is given a name based on the file name.
- A plain text file (.txt) – This is the same as the Pascal unit file except that the extension is .txt rather than .pas.
- An HTML file (.html) – This option writes the source code out as a valid XHTML document that uses embedded CSS to format the code. The source code will be syntax highlighted if the Use syntax highlighting check box is checked.
- A rich text file (.rtf) – The source code is written out as an RTF document. Again syntax highlighting can be used if the Use syntax highlighting check box is checked.

Each snippet's description can be written as a Pascal comment to the output file. Use the Comment style drop down list to specify the style of commenting to be used. Such comments can be inhibited by selecting the No descriptive comments option from the list. If the Truncate comments to 1st paragraph check box is ticked then only the first paragraph of each snippet's description is used. Clearing this check box means that the full text of snippet descriptions are used.

The output file encoding can be be specified in the File Encoding drop down list. Options vary depending on the file type. Some file types support only a single encoding. The encodings are:

- ANSI (Default) – the system default ANSI encoding. Available for both plain text and Pascal unit files and as the only option for rich text files.
- UTF-8 – UTF-8 encoding, with BOM†. Available for both plain text and Pascal unit files and as the only option for XHTML files. If used for Pascal units be warned that the unit will only compile with compilers that support Unicode source files.
- Unicode (Little Endian) – UTF-16 LE encoding, with BOM†. Available for plain text files only.
- Unicode (Big Endian) – UTF-16 BE encoding, with BOM†. Available for plain text files only.

The output can be previewed by clicking the Preview button. This displays the source code in a dialogue box, formatted according to your selections. Text in the preview can be selected and copied to the clipboard if required.

Use the Save button to write the unit to disk or Cancel to abort.

### Footnote

† BOM = Byte Order Mark or Preamble: a sequence of bytes at the start of a text file that identifies its encoding.