davidgohel / ReporteRs

Note that ReporteRs has been removed from CRAN the 16th of July 2018 and is not maintained anymore. please migrate to officer.
245 stars 44 forks source link

will there be a body_replace_flextable_at_bkm() function soon? #228

Closed AnnaBurn closed 5 years ago

AnnaBurn commented 5 years ago

Hi,

I am loving the flextable and OfficeR packages, but it would be really useful to have a body_replace_flextable_at_bkm() as I often need to include tables in my final reports. Is this a feature that will be coming soon?

davidgohel commented 5 years ago

Dear Anna

This should help:

library(officer)
library(flextable)
library(magrittr)

ft <- regulartable(head(mtcars))

doc <- read_docx() %>%
  body_add_par("centered text", style = "centered") %>%
  body_bookmark("val_to_replace") %>%
  body_add_par("A title", style = "heading 1") %>%
  body_add_par("Hello world!", style = "Normal") %>%
  cursor_bookmark("val_to_replace") %>%
  body_add_flextable(value = ft, pos = "on")

print(doc, target = tempfile(fileext = ".docx")) %>% browseURL()
davidgohel commented 5 years ago

Issue moved to davidgohel/flextable #81 via ZenHub