【问题标题】:Cannot install SWinTypeLibs, but need to know what functions are in ComCreate(Word.Application)无法安装 SWinTypeLibs,但需要知道 ComCreate(Word.Application) 中有哪些函数
【发布时间】:2022-01-11 03:56:23
【问题描述】:

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

我目前正在尝试将大量 .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 这样的单词列表真的需要它。

提前感谢所有帮助。

詹姆斯

【问题讨论】:

  • 也急于列出所有的 com 对象方法

标签: r vba rdcomclient


【解决方案1】:

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

karnner2/SWinTypeLibs

devtools::install_github("Karnner2/SWinTypeLibs")

【讨论】:

    猜你喜欢
    • 2022-12-03
    • 2016-12-13
    • 1970-01-01
    • 1970-01-01
    • 2023-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多