diff --git a/contrib/lisp/org-lparse.el b/contrib/lisp/org-lparse.el index fbc902490..ac98ff53b 100755 --- a/contrib/lisp/org-lparse.el +++ b/contrib/lisp/org-lparse.el @@ -1316,13 +1316,12 @@ version." (org-lparse-format-table-table lines)))) (defun org-lparse-table-get-colalign-info (lines) - (let ((forced-aligns (org-find-text-property-in-string - 'org-forced-aligns (car lines)))) - (when (and forced-aligns org-table-clean-did-remove-column) - (setq forced-aligns - (mapcar (lambda (x) (cons (1- (car x)) (cdr x))) forced-aligns))) - - forced-aligns)) + (let ((col-cookies (org-find-text-property-in-string + 'org-col-cookies (car lines)))) + (when (and col-cookies org-table-clean-did-remove-column) + (setq col-cookies + (mapcar (lambda (x) (cons (1- (car x)) (cdr x))) col-cookies))) + col-cookies)) (defvar org-lparse-table-style) (defvar org-lparse-table-ncols) @@ -2059,12 +2058,13 @@ See `org-xhtml-entity-format-callbacks-alist' for more information." (make-vector org-lparse-table-ncols nil)) (let ((c -1)) (while (< (incf c) org-lparse-table-ncols) - (let ((cookie (cdr (assoc (1+ c) org-lparse-table-colalign-info)))) + (let* ((col-cookie (cdr (assoc (1+ c) org-lparse-table-colalign-info))) + (align (nth 0 col-cookie))) (setf (aref org-lparse-table-colalign-vector c) (cond - ((string= cookie "l") "left") - ((string= cookie "r") "right") - ((string= cookie "c") "center") + ((string= align "l") "left") + ((string= align "r") "right") + ((string= align "c") "center") (t nil)))))))) (incf org-lparse-table-rownum) (let ((i -1)) @@ -2075,11 +2075,15 @@ See `org-xhtml-entity-format-callbacks-alist' for more information." (when (and (string= x "") text-for-empty-fields) (setq x text-for-empty-fields)) (incf i) - (and org-lparse-table-is-styled - (< i org-lparse-table-ncols) - (string-match org-table-number-regexp x) - (incf (aref org-lparse-table-num-numeric-items-per-column i))) - (org-lparse-format 'TABLE-CELL x org-lparse-table-rownum i)) + (let (col-cookie horiz-span) + (when org-lparse-table-is-styled + (when (and (< i org-lparse-table-ncols) + (string-match org-table-number-regexp x)) + (incf (aref org-lparse-table-num-numeric-items-per-column i))) + (setq col-cookie (cdr (assoc (1+ i) org-lparse-table-colalign-info)) + horiz-span (nth 1 col-cookie))) + (org-lparse-format + 'TABLE-CELL x org-lparse-table-rownum i (or horiz-span 0)))) fields "\n")))) (defun org-lparse-get (what &optional opt-plist) diff --git a/contrib/lisp/org-odt.el b/contrib/lisp/org-odt.el index 5c3f7fb34..f088b0519 100644 --- a/contrib/lisp/org-odt.el +++ b/contrib/lisp/org-odt.el @@ -703,14 +703,20 @@ implementation filed under `org-odt-get-table-cell-styles'." (or label "") (or (nth 1 org-odt-table-style-spec) "OrgTable")) (setq org-lparse-table-begin-marker (point))) +(defvar org-lparse-table-colalign-info) (defun org-odt-end-table () (goto-char org-lparse-table-begin-marker) (loop for level from 0 below org-lparse-table-ncols - do (insert - (org-odt-format-tags - "" - "" (or (nth 1 org-odt-table-style-spec) "OrgTable")))) - + do (let* ((col-cookie (and org-lparse-table-is-styled + (cdr (assoc (1+ level) + org-lparse-table-colalign-info)))) + (extra-columns (or (nth 1 col-cookie) 0))) + (dotimes (i (1+ extra-columns)) + (insert + (org-odt-format-tags + "" + "" (or (nth 1 org-odt-table-style-spec) "OrgTable")))) + (insert "\n"))) ;; fill style attributes for table cells (when org-lparse-table-is-styled (while (re-search-forward "@@\\(table-cell:p\\|table-cell:style-name\\)@@\\([0-9]+\\)@@\\([0-9]+\\)@@" nil t) @@ -837,17 +843,26 @@ styles congruent with the ODF-1.2 specification." (when org-lparse-table-is-styled (format "@@table-cell:style-name@@%03d@@%03d@@" r c))) -(defun org-odt-format-table-cell (data r c) - (let* ((paragraph-style-cookie - (org-odt-get-paragraph-style-cookie-for-table-cell r c)) - (style-name-cookie - (org-odt-get-style-name-cookie-for-table-cell r c)) - (extra (if style-name-cookie - (format " table:style-name=\"%s\"" style-name-cookie) ""))) - (org-odt-format-tags - '("" . "") - (if org-lparse-list-table-p data - (org-odt-format-stylized-paragraph paragraph-style-cookie data)) extra))) +(defun org-odt-format-table-cell (data r c horiz-span) + (concat + (let* ((paragraph-style-cookie + (org-odt-get-paragraph-style-cookie-for-table-cell r c)) + (style-name-cookie + (org-odt-get-style-name-cookie-for-table-cell r c)) + (extra (and style-name-cookie + (format " table:style-name=\"%s\"" style-name-cookie))) + (extra (concat extra + (and (> horiz-span 0) + (format " table:number-columns-spanned=\"%d\"" + (1+ horiz-span)))))) + (org-odt-format-tags + '("" . "") + (if org-lparse-list-table-p data + (org-odt-format-stylized-paragraph paragraph-style-cookie data)) extra)) + (let (s) + (dotimes (i horiz-span) + (setq s (concat s "\n"))) s) + "\n")) (defun org-odt-begin-footnote-definition (n) (org-lparse-begin-paragraph 'footnote)) diff --git a/contrib/lisp/org-xhtml.el b/contrib/lisp/org-xhtml.el index f4f9181d9..188678c5b 100644 --- a/contrib/lisp/org-xhtml.el +++ b/contrib/lisp/org-xhtml.el @@ -1558,7 +1558,7 @@ lang=\"%s\" xml:lang=\"%s\"> (cons (eval (car org-export-table-row-tags)) (eval (cdr org-export-table-row-tags))) row)) -(defun org-xhtml-format-table-cell (text r c) +(defun org-xhtml-format-table-cell (text r c horiz-span) (let ((cell-style-cookie (or (and org-lparse-table-is-styled (format "@@class%03d@@" c)) ""))) (cond