Next: , Previous: , Up: The Basics   [Contents][Index]

3.3 Printer functions

Printer functions convert binary cell values into the print forms that Emacs will display on the screen.

A printer can be a format string, like ‘"$%.2f"’. The result string is right-aligned within the print cell. To get left-alignment, use parentheses: ‘("$%.2f")’. A printer can also be a one-argument function (a symbol or a lambda), whose result is a string (right-aligned) or list of one string (left-aligned). While typing in a lambda, you can use M-TAB to complete the names of symbols.

Each cell has a printer. If nil, the column-printer for the cell’s column is used. If that is also nil, the default-printer for the spreadsheet is used.

p

Enter a printer for current cell or range (ses-read-cell-printer).

M-p

Enter a printer for the current column (ses-read-column-printer).

C-c C-p

Enter the default printer for the spreadsheet (ses-read-default-printer).

The ses-read-XXX-printer commands have their own minibuffer history, which is preloaded with the set of all printers used in this spreadsheet, plus the standard printers.

The standard printers are suitable only for cells, not columns or default, because they format the value using the column-printer (or default-printer if nil) and then center the result:

ses-center

Just centering.

ses-center-span

Centering with spill-over to following blank cells.

ses-dashfill

Centering using dashes (-) instead of spaces.

ses-dashfill-span

Centering with dashes and spill-over.

ses-tildefill-span

Centering with tildes (~) and spill-over.

You can define printer function local to a sheet with the command ses-define-local-printer. For instance, define a printer ‘foo’ to "%.2f", and then use symbol ‘foo’ as a printer function. Then, if you call again ses-define-local-printer on ‘foo’ to redefine it as "%.3f", all the cells using printer ‘foo’ will be reprinted accordingly.

Next: , Previous: , Up: The Basics   [Contents][Index]