英文:
Flextable Word output - How to display each table on a different page?
问题
我有几张表格想要保存在Word文档中。
具体来说,我想要在不同的页面上显示每张表格。
我该如何做到这一点?
library(flextable)
head(mtcars)
FT = flextable(head(mtcars))
save_as_docx(values = list(FT, FT), path = "result.docx")
英文:
I have several tables that I want to save in a Word document.
Specifically, I would like to display each table on a different page.
How can I do this?
library(flextable)
head(mtcars)
FT=flextable(head(mtcars))
save_as_docx(values=list(FT,FT),path="result.docx")
答案1
得分: 1
officer是一个可能的解决方案:
library(officer)
library(flextable)
head(mtcars)
FT = flextable(head(mtcars))
read_docx() |>
body_add_flextable(FT) |>
body_add_break() |>
body_add_flextable(FT) |>
body_add_break() |>
print(target="result.docx")
英文:
officer is a possible solution:
library(officer)
library(flextable)
head(mtcars)
FT=flextable(head(mtcars))
read_docx() |>
body_add_flextable(FT) |>
body_add_break() |>
body_add_flextable(FT) |>
body_add_break() |>
print(target="result.docx")
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论