Function: org-odt-table-cell

org-odt-table-cell is a byte-compiled function defined in ox-odt.el.gz.

Signature

(org-odt-table-cell TABLE-CELL CONTENTS INFO)

Documentation

Transcode a TABLE-CELL element from Org to ODT.

CONTENTS is nil. INFO is a plist used as a communication channel.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-odt.el.gz
(defun org-odt-table-cell (table-cell contents info)
  "Transcode a TABLE-CELL element from Org to ODT.
CONTENTS is nil.  INFO is a plist used as a communication
channel."
  (let* ((table-cell-address (org-export-table-cell-address table-cell info))
	 (r (car table-cell-address))
	 (c (cdr table-cell-address))
	 (horiz-span (or (org-export-table-cell-width table-cell info) 0))
	 (table-row (org-export-get-parent table-cell))
	 (custom-style-prefix (org-odt-get-table-cell-styles
			       table-cell info))
	 (paragraph-style
	  (or
	   (and custom-style-prefix
		(format "%sTableParagraph" custom-style-prefix))
	   (concat
	    (cond
	     ((and (= 1 (org-export-table-row-group table-row info))
		   (org-export-table-has-header-p
		    (org-export-get-parent-table table-row) info))
	      "OrgTableHeading")
	     ((let* ((table (org-export-get-parent-table table-cell))
		     (table-attrs (org-export-read-attribute :attr_odt table))
		     (table-header-columns
		      (let ((cols (plist-get table-attrs :header-columns)))
			(and cols (read cols)))))
		(<= c (cond ((wholenump table-header-columns)
			     (- table-header-columns 1))
			    (table-header-columns 0)
			    (t -1))))
	      "OrgTableHeading")
	     (t "OrgTableContents"))
	    (capitalize (symbol-name (org-export-table-cell-alignment
				      table-cell info))))))
	 (cell-style-name
	  (or
	   (and custom-style-prefix (format "%sTableCell"
					    custom-style-prefix))
	   (concat
	    "OrgTblCell"
	    (when (or (org-export-table-row-starts-rowgroup-p table-row info)
		      (zerop r)) "T")
	    (when (org-export-table-row-ends-rowgroup-p table-row info) "B")
	    (when (and (org-export-table-cell-starts-colgroup-p table-cell info)
		       (not (zerop c)) ) "L"))))
	 (cell-attributes
	  (concat
	   (format " table:style-name=\"%s\"" cell-style-name)
	   (and (> horiz-span 0)
		(format " table:number-columns-spanned=\"%d\""
			(1+ horiz-span))))))
    (unless contents (setq contents ""))
    (concat
     (cl-assert paragraph-style)
     (format "\n<table:table-cell%s>\n%s\n</table:table-cell>"
	     cell-attributes
	     (let ((table-cell-contents (org-element-contents table-cell)))
	       (if (eq (org-element-class (car table-cell-contents)) 'element)
		   contents
		 (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
			 paragraph-style contents))))
     (let (s)
       (dotimes (_ horiz-span s)
	 (setq s (concat s "\n<table:covered-table-cell/>"))))
     "\n")))