Alternative to default officer
print() function. Write the file and try to open it right away.
Source: R/officer.R
write_and_open.Rd
As it tests if the file is writable, this function also prevents officer:::print.rdocx()
to abort the RStudio session.
Examples
library(officer)
library(crosstable)
mytable = crosstable(mtcars2)
doc = read_docx() %>%
body_add_crosstable(mytable)
write_and_open(doc)
if (FALSE) { # \dontrun{
write_and_open(doc, "example.docx")
} # }