Add styling rules in pandoc tables for odt/docx output (table borders)

前端 未结 6 1538
一整个雨季
一整个雨季 2020-12-24 02:42

I\'m generating some odt/docx reports via markdown using knitr and pandoc and am now wondering how you\'d go about formating tables. Primarily I\'m interested in adding rule

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-24 03:05

    edi9999 has the best answer but here's what I do:

    When creating the docx, use a reference docx to get styles. That reference will contain a heap of other styles that just aren't used by Pandoc to create, but they are still in there. Typically you'll get the default sets, but you can add a new table style too.

    Then, you only need to update the word\document.xml file to reference the new table style, and you can do that programmatically (by unzipping, running sed, and updating the docx archive), eg:

    7z.exe x mydoc.docx word\document.xml
    sed "s/ word\document2.xml
    copy word\document2.xml word\document.xml /y
    7z.exe u mydoc.docx word\document.xml
    

提交回复
热议问题