Function: ses-center
ses-center is a byte-compiled function defined in ses.el.gz.
Signature
(ses-center VALUE &optional SPAN FILL PRINTER)
Documentation
Print VALUE, centered within column.
FILL is the fill character for centering (default = space). SPAN indicates how many additional rightward columns to include in width (default = 0). PRINTER is the printer to use for printing the value, default is the column printer if any, or the spreadsheet the spreadsheet default printer otherwise.
Source Code
;; Defined in /usr/src/emacs/lisp/ses.el.gz
;;----------------------------------------------------------------------------
;; Standard print functions
;;----------------------------------------------------------------------------
(defun ses-center (value &optional span fill printer)
"Print VALUE, centered within column.
FILL is the fill character for centering (default = space).
SPAN indicates how many additional rightward columns to include
in width (default = 0).
PRINTER is the printer to use for printing the value, default is the
column printer if any, or the spreadsheet the spreadsheet default
printer otherwise."
(setq printer (or printer (ses-col-printer ses--col) ses--default-printer))
(let ((width (ses-col-width ses--col))
half)
(or fill (setq fill ?\s))
(or span (setq span 0))
(setq value (ses-call-printer printer value))
(dotimes (x span)
(setq width (+ width 1 (ses-col-width (+ ses--col span (- x))))))
;; Set column width.
(setq width (- width (string-width value)))
(if (<= width 0)
value ; Too large for field, anyway.
(setq half (make-string (/ width 2) fill))
(concat half value half
(if (> (% width 2) 0) (char-to-string fill))))))