我一直用这个方案,从懒猫大佬的Emacs配置那里抄了个函数:
(defun org-export-docx ()
"Export current buffer to docx file with the template.docx."
(interactive)
(let ((docx-file (concat (file-name-sans-extension (buffer-file-name)) ".docx"))
(template-file (expand-file-name "template.docx" no-littering-var-directory)))
(shell-command (format "pandoc %s -o %s --reference-doc=%s"
(buffer-file-name) docx-file template-file))
(message "Convert finish: %s" docx-file)))
可以自己指定 Word 模板,类似这个: