library(officer)
# This example demonstrates how to create
# an small document -----
## Create a new Word document
doc <- read_docx()
doc <- body_add_par(doc, "hello world")
## Save the document
output_file <- print(doc, target = tempfile(fileext = ".docx"))
# preview mode: save to temp file and open locally ----
if (FALSE) {
print(doc, preview = TRUE)
}
Run the code above in your browser using DataLab