1

我是 R 的新手。我非常感谢每一个帮助。我创建了一个 flextable 并希望将文件导出到 word 文档。这工作正常。我按照建议使用了一个临时文件“https://davidgohel.github.io/flextable/reference/save_as_docx.html”。我尝试将此临时文件导出或保存到我的工作目录,但这不起作用:

 library(officer)
ft1 <- as_flex_table (ex_tbl)
sect_properties <- prop_section(
  page_size = page_size(orient = "landscape",
                        width = 8.3, height = 11.7),
  type = "continuous")
  
save_as_docx(ft1, path = tf)
save_as_docx(`Table 1` = ft1, path = **("\\Users\\XXX\\Desktop\\example_2.docx")**, pr_section = sect_properties).
 save_as_docx(`Table 1` = ft1, path = ("\\Users\\XXX\\Desktop\\example_2.docx"), pr_section = sect_properties)

=> 错误:\Users\XXX\Desktop\example_2.docx 的目录不存在。此外,打印功能不起作用。

print(tf, target = "c:/Users/Hendrik/Desktop/")

是否可以将临时文件直接保存在工作目录中

4

0 回答 0