emacs-unoffice

Emacs library to reclaim text from office documents (abw, odt, docx).
Log | Files | Refs

commit e8f0159f965233b8e2756d9747051e68fb912b45
parent fe424f55bacbb9e33a99945b7155c14f93c22bc3
Author: Tomas Hlavaty <tom@logand.com>
Date:   Mon, 25 Jan 2021 23:43:01 +0100

handle tables in docx, roughly

Diffstat:
Memacs-unoffice.el | 17+++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/emacs-unoffice.el b/emacs-unoffice.el @@ -19,6 +19,7 @@ (require 'arc-mode) (require 'cl) +(require 'org-table) (require 'view) (require 'xml) @@ -62,14 +63,26 @@ (interactive) (with-silent-modifications (erase-buffer) - (let (wrote) + (let (wrote tablep) (cl-labels ((ins (x) (when (and x (not (equal "" x))) (insert x) - (setq wrote t))) + (unless tablep + (setq wrote t)))) (rec (x) (when (consp x) (case (car x) + (w:tc + (insert "|") + (mapc #'rec (cddr x))) + (w:tr + (mapc #'rec (cddr x)) + (insert "\n")) + (w:tbl + (setq tablep t) + (mapc #'rec (cddr x)) + (setq tablep nil) + (org-table-align)) (w:p (mapc #'rec (cddr x)) (when wrote (ins "\n\n")