Flextable Word输出 – 如何在不同页面上显示每个表格?

huangapple go评论85阅读模式
英文:

Flextable Word output - How to display each table on a different page?

问题

我有几张表格想要保存在Word文档中。

具体来说,我想要在不同的页面上显示每张表格。

我该如何做到这一点?

  1. library(flextable)
  2. head(mtcars)
  3. FT = flextable(head(mtcars))
  4. 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?

  1. library(flextable)
  2. head(mtcars)
  3. FT=flextable(head(mtcars))
  4. save_as_docx(values=list(FT,FT),path="result.docx")

答案1

得分: 1

officer是一个可能的解决方案:

  1. library(officer)
  2. library(flextable)
  3. head(mtcars)
  4. FT = flextable(head(mtcars))
  5. read_docx() |>
  6. body_add_flextable(FT) |>
  7. body_add_break() |>
  8. body_add_flextable(FT) |>
  9. body_add_break() |>
  10. print(target="result.docx")
英文:

officer is a possible solution:

  1. library(officer)
  2. library(flextable)
  3. head(mtcars)
  4. FT=flextable(head(mtcars))
  5. read_docx() |>
  6. body_add_flextable(FT) |>
  7. body_add_break() |>
  8. body_add_flextable(FT) |>
  9. body_add_break() |>
  10. print(target="result.docx")

huangapple
  • 本文由 发表于 2023年4月4日 15:54:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/75926821.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定