
Last chance! 50% off unlimited learning
Sale ends in
add a flextable into a Word document.
body_add_flextable(x, value, align = "center", pos = "after",
split = FALSE)body_replace_flextable_at_bkm(x, bookmark, value, align = "center",
split = FALSE)
an rdocx object
flextable
object
left, center (default) or right.
where to add the flextable relative to the cursor, one of "after", "before", "on" (end of line).
set to TRUE if you want to activate Word option 'Allow row to break across pages'.
bookmark id
Use this function if you want to replace a paragraph containing a bookmark with a flextable. As a side effect, the bookmark will be lost.
# 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)
# }
# NOT RUN {
print(doc, target = "test.docx")
# }
Run the code above in your browser using DataLab