首页 > 解决方案 > pandoc docx:没有表或坏表

问题描述

我正在尝试使用 pandoc 在 docx 中生成表格,但无法使其工作。LibreOffice 至少会尝试生成一个表格,而 OpenOffice 只是忽略表格,完全将单元格视为具有对齐的段落。

它应该工作吗?我可以修复设置中的某些内容以使其正常工作吗?可能可以在参考文档中以样式制作一些东西吗?

这是tmp.md包含三个表格示例的完整文件:


plain text

  Right     Left     Center     Default
-------     ------ ----------   -------
     12     12        12            12
    123     123       123          123
      1     1          1             1


---------------------------------------------------------------------------
Item                        Kilowatts        Use               Cost
---------------             ---------------  ----------------  -----------
Geothermal Plant            **`1250.0`**     Electricity       **` 4.4`**

Houses                      **`13.7`**       Shelter           **` 4.2`**
---------------------------------------------------------------------------


| head1 | head 2 |
|-------|---------
| data1 | data2  |
| data3 | data4  |

这就是我运行的

$ pandoc tmp.md -o tmp.docx

这就是我在 OpenOffice 中得到的

在此处输入图像描述

这就是我在 LibreOffice 中得到的 在此处输入图像描述

这是我的 pandoc 版本:

$ pandoc --version
pandoc 2.7.3
Compiled with pandoc-types 1.17.5.4, texmath 0.11.2.2, skylighting 0.8.1

该系统是macOS Mojave 10.14.6

表扩展集是

$ pandoc --list-extensions| grep -i table
+grid_tables
+multiline_tables
+pipe_tables
+simple_tables
+table_captions

标签: markdowndocxpandoc

解决方案


推荐阅读