Function: org-odt--table

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

Signature

(org-odt--table TABLE CONTENTS INFO)

Documentation

Transcode a TABLE element from Org to ODT.

CONTENTS is the contents of the table. INFO is a plist holding contextual information.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-odt.el.gz
(defun org-odt--table (table contents info)
  "Transcode a TABLE element from Org to ODT.
CONTENTS is the contents of the table.  INFO is a plist holding
contextual information."
  (cl-case (org-element-property :type table)
    ;; Case 1: table.el doesn't support export to OD format.  Strip
    ;; such tables from export.
    (table.el
     (prog1 nil
       (message
	(concat
	 "(ox-odt): Found table.el-type table in the source Org file."
	 "  table.el doesn't support export to ODT format."
	 "  Stripping the table from export."))))
    ;; Case 2: Native Org tables.
    (otherwise
     (let* ((captions (org-odt-format-label table info 'definition))
	    (caption (car captions)) (short-caption (cdr captions))
	    (attributes (org-export-read-attribute :attr_odt table))
	    (custom-table-style (nth 1 (org-odt-table-style-spec table info)))
	    (table-column-specs
	     (lambda (table info)
	       (let* ((table-style (or custom-table-style "OrgTable"))
		      (column-style (format "%sColumn" table-style)))
		 (mapconcat
		  (lambda (table-cell)
		    (let ((width (1+ (or (org-export-table-cell-width
					  table-cell info) 0)))
			  (s (format
			      "\n<table:table-column table:style-name=\"%s\"/>"
			      column-style))
			  out)
		      (dotimes (_ width out) (setq out (concat s out)))))
		  (org-odt-table-first-row-data-cells table info) "\n")))))
       (concat
	;; caption.
	(when caption
	  (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
		  "Table" caption))
	;; begin table.
	(let* ((automatic-name
		(org-odt-add-automatic-style "Table" attributes)))
	  (format
	   "\n<table:table table:style-name=\"%s\"%s>"
	   (or custom-table-style (cdr automatic-name) "OrgTable")
	   (concat (when short-caption
		     (format " table:name=\"%s\"" short-caption)))))
	;; column specification.
	(funcall table-column-specs table info)
	;; actual contents.
	"\n" contents
	;; end table.
	"</table:table>")))))