我可以通过 RDCOMClinet 包将 excel 文件附加到 Outlook 中。但是如何通过 R 在邮件正文中显示 excel 工作表内容?假设工作表中包含一个表格和一个图表。
library(RDCOMClient)
## init com api
OutApp <- COMCreate("Outlook.Application")
## create an email
outMail = OutApp$CreateItem(0)
## configure email parameter
outMail[["To"]] = "name@email.com"
outMail[["subject"]] = paste0("Report ", Sys.Date() - 1)
# attach a file via its directory
dirs <- dir(getwd(), full.names = TRUE)
outMail[["Attachments"]]$Add(dirs)
# insert an excel worksheet from attachment or local drive
outMail[["HTMLBody"]] = ?