Function: org-odt-get-table-cell-styles
org-odt-get-table-cell-styles is a byte-compiled function defined in
ox-odt.el.gz.
Signature
(org-odt-get-table-cell-styles TABLE-CELL INFO)
Documentation
Retrieve styles applicable to a table cell.
R and C are (zero-based) row and column numbers of the table
cell. STYLE-SPEC is an entry in org-odt-table-styles
applicable to the current table. It is nil if the table is not
associated with any style attributes.
Return a cons of (TABLE-CELL-STYLE-NAME . PARAGRAPH-STYLE-NAME).
When STYLE-SPEC is nil, style the table cell the conventional way
- choose cell borders based on row and column groupings and
choose paragraph alignment based on table alignment cookies (see info
node (org)Column Width and Alignment). See also
org-odt-table-style-spec.
When STYLE-SPEC is non-nil, ignore the above cookie and return styles congruent with the ODF-1.2 specification.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-odt.el.gz
(defun org-odt-get-table-cell-styles (table-cell info)
"Retrieve styles applicable to a table cell.
R and C are (zero-based) row and column numbers of the table
cell. STYLE-SPEC is an entry in `org-odt-table-styles'
applicable to the current table. It is nil if the table is not
associated with any style attributes.
Return a cons of (TABLE-CELL-STYLE-NAME . PARAGRAPH-STYLE-NAME).
When STYLE-SPEC is nil, style the table cell the conventional way
- choose cell borders based on row and column groupings and
choose paragraph alignment based on table alignment cookies (see info
node `(org)Column Width and Alignment'). See also
`org-odt-table-style-spec'.
When STYLE-SPEC is non-nil, ignore the above cookie and return
styles congruent with the ODF-1.2 specification."
(let* ((table-cell-address (org-export-table-cell-address table-cell info))
(r (car table-cell-address)) (c (cdr table-cell-address))
(style-spec (org-odt-table-style-spec table-cell info))
(table-dimensions (org-export-table-dimensions
(org-element-lineage table-cell 'table)
info)))
(when style-spec
;; LibreOffice - particularly the Writer - honors neither table
;; templates nor custom table-cell styles. Inorder to retain
;; interoperability with LibreOffice, only automatic styles are
;; used for styling of table-cells. The current implementation is
;; congruent with ODF-1.2 specification and hence is
;; future-compatible.
;; Additional Note: LibreOffice's AutoFormat facility for tables -
;; which recognizes as many as 16 different cell types - is much
;; richer. Unfortunately it is NOT amenable to easy configuration
;; by hand.
(let* ((template-name (nth 1 style-spec))
(cell-style-selectors (nth 2 style-spec))
(cell-type
(cond
((and (cdr (assq 'use-first-column-styles cell-style-selectors))
(= c 0)) "FirstColumn")
((and (cdr (assq 'use-last-column-styles cell-style-selectors))
(= (1+ c) (cdr table-dimensions)))
"LastColumn")
((and (cdr (assq 'use-first-row-styles cell-style-selectors))
(= r 0)) "FirstRow")
((and (cdr (assq 'use-last-row-styles cell-style-selectors))
(= (1+ r) (car table-dimensions)))
"LastRow")
((and (cdr (assq 'use-banding-rows-styles cell-style-selectors))
(cl-oddp r)) "EvenRow")
((and (cdr (assq 'use-banding-rows-styles cell-style-selectors))
(cl-evenp r)) "OddRow")
((and (cdr (assq 'use-banding-columns-styles cell-style-selectors))
(cl-oddp c)) "EvenColumn")
((and (cdr (assq 'use-banding-columns-styles cell-style-selectors))
(cl-evenp c)) "OddColumn")
(t ""))))
(concat template-name cell-type)))))