doc <- read_docx()
doc <- body_add_par(doc, "A title", style = "heading 1")
doc <- body_add_par(doc, "Hello world!", style = "Normal")
doc <- body_add_par(doc, "centered text", style = "centered")
print(doc, target = tempfile(fileext = ".docx"))
Run the code above in your browser using DataLab