# NOT RUN {
library(officer)
ft <- flextable(head(mtcars))
ft <- theme_zebra(ft)
# }
# NOT RUN {
ft <- autofit(ft)
# }
# NOT RUN {
doc <- read_docx()
doc <- body_add_flextable(doc, value = ft)
fileout <- tempfile(fileext = ".docx")
# fileout <- "test.docx" # uncomment to write in your working directory
print(doc, target = fileout)
# }
Run the code above in your browser using DataLab