1

如果这不完美,请原谅我,但这是我的第一篇文章。

我目前正在尝试将大量 .docx 文档转换为 .pdf

我找到了创造奇迹的 RDCOMClient 包。但是我现在需要在我的图表中添加替代文本。我正在使用的代码如下:

library(RDCOMClient)
library(plyr)
library(tidyverse)

# this will destroy all objects in your workspace so be careful
# rm(list = ls()) # deletes all data frames

file <- "directory"

wordApp <- COMCreate("Word.Application")  # create COM object
wordApp[["Visible"]] <- FALSE #opens a Word application instance visibly if true 
wordApp[["Documents"]]$Add() #adds new blank docx in your application
wordApp[["Documents"]]$Open(Filename=file) #opens your docx in wordApp

#THIS IS THE MAGIC    
wordApp[["ActiveDocument"]]$SaveAs("Directory", 
                                   FileFormat=17) #FileFormat=17 saves as .PDF

wordApp[["ActiveDocument"]]$Close(SaveChanges = 1) # says there are no changes that need saving

在像 Documents 这样的 double [] 中有函数的地方有图表。

我在这里的链接中找到了完整的 excel 列表:http ://www.omegahat.net/RDCOMClient/Docs/introduction.html

但是,我尝试使用以下代码安装 SWinTypeLibs 包以获取相同的单词:

install.packages("remotes")
remotes::install_github("omegahat/SWinTypeLibs")

并不断收到错误

如果有人有像上面的excel这样的单词列表,真的需要它。

感谢您提前提供的所有帮助。

詹姆士

4

1 回答 1

1

我已经对来自 omegahat 的原始包中的 .Rd 文档进行了快速修复。你可以在这里找到它——现在应该编译。

karnner2/SWinTypeLibs

devtools::install_github("Karnner2/SWinTypeLibs")
于 2022-01-10T03:29:27.470 回答