My prior understanding was that the ability to utilize Microsoft Word Table styles is only available in the officedown
package, but syntax like
read_docx(path = "reports/template.docx") %>%
body_add_flextable(my_ft) %>%
print(target = "reports/example_template.docx")
suggests some ability to format Word flextable
objects, e.g. those one would use for outputting regressions, according to Word document Table-styles? Is this feature available in the officer
package? If so, how do I use it?
CodePudding user response:
You can use body_add_table()
:
doc <- read_docx()
doc <- body_add_table(doc, iris, style = "table_template")
print(doc, target = tempfile(fileext = ".docx") )
But flextable objects cannot be associated with a specific Word table template. To style a flextable object, you can only use flextable functions.