更新现有 table 的内容和 table 的 table 官员 r

Update existing table of contents and table of tables officer r

有没有办法使用 officer 在我的文档中更新现有 table 的内容和 table 的 table 内容?我知道函数 body_add_toc() 但有没有办法更新这些元素而不必重新创建它们?

否,TOC 正在由 Word 计算。 R 不知道什么内容在什么页面。据我所知,实现这一目标的唯一方法是 VBS 宏。

据我所知,大卫是正确的。

如果您需要自动执行此过程,您可以使用 officerWinTools R 包中的 update_toc(x) 函数。

officerWinTools R 包需要安装了 Microsoft Office 的 Windows 操作系统(此包的功能依赖命令提示符中的 VBScript 运行)。

update_toc(x) 函数也嵌入在 print_docx_pdf(x, target = "path") 函数中,它将使用 officer R 包创建的文档作为 .PDF 导出到给定路径。

您可以从 GitHub 安装 officerWinTools R 包:

devtools::install_github("joshmire/officerWinTools")

另外,向大卫大声喊叫;你的 R 包让我的工作不再那么头疼了。