【问题标题】:How to track changes in word .docx files generated from within R如何跟踪从 R 中生成的 word .docx 文件的更改
【发布时间】:2018-08-16 22:14:38
【问题描述】:

我正在尝试使用奇妙的“bookdown2”包(作为令人难以置信的 rrtools 包的一部分)在 R 中编写可重现的手稿,这些手稿以 .docx 格式发送给出版商以供同行评审。

在同行评审过程之后,通常需要进行更正。

大多数期刊在引入审后更正后,都需要手稿的标记版本。

有没有办法在 R 中生成带有“更改跟踪”的 word 文件?

我知道可以生成两个文件并使用 Word 来比较两个版本。这可行,但与可重现的工作流程不一致,容易出错,需要点击以及 Microsoft Word 软件。

必须有更好的方法。

【问题讨论】:

    标签: r ms-word bookdown officer


    【解决方案1】:

    Noam Ross 有一个非常酷的 R 包。包,redoc - Reversible Reproducible Documents,尚未在 CRAN 上。开发版在 github 上。

    见: https://noamross.github.io/redoc/

    【讨论】:

      【解决方案2】:

      以下代码显示了一个简单示例,说明我们如何比较两个单词文件以获取跟踪更改:

      library(RDCOMClient)
      
      path_To_File1 <- "C:\\...\\Word File 1.docx"
      path_To_File2 <- "C:\\...\\Word File 2.docx"
      
      wordApp <- COMCreate("Word.Application")
      doc1 <- wordApp[["Documents"]]$Open(normalizePath(path_To_File1))
      doc2 <- wordApp[["Documents"]]$Open(normalizePath(path_To_File2))
      
      doc3 <- wordApp[["Application"]]$CompareDocuments(OriginalDocument = doc1,
                                                        RevisedDocument = doc2)
      
      doc3$SaveAs("C:\\...\\Word File Compared 1-2.docx")
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-05-31
        • 2018-11-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-05-21
        • 1970-01-01
        相关资源
        最近更新 更多