1

我之前的理解是,使用 Microsoft Word 表格样式的功能仅在officedown包中可用,但语法如

read_docx(path = "reports/template.docx") %>%
body_add_flextable(my_ft) %>%
print(target = "reports/example_template.docx")

建议一些格式化 Wordflextable对象的能力,例如根据 Word 文档表格样式用于输出回归的那些?包中是否提供此功能officer?如果是这样,我该如何使用它?

4

1 回答 1

1

您可以使用body_add_table()

doc <- read_docx()
doc <- body_add_table(doc, iris, style = "table_template")
print(doc, target = tempfile(fileext = ".docx") )

但 flextable 对象不能与特定的 Word 表格模板相关联。要设置 flextable 对象的样式,您只能使用 flextable 函数。

于 2022-01-04T16:07:14.083 回答