According to the documentation located at the link at the bottom of this post, I can center a ggplot on a rdocx page:
library(ggplot2)
gg <- ggplot(data = iris, aes(Sepal.Length, Petal.Length)) +
geom_point()
doc_section_1 <- read_docx()
doc_section_1 <- body_add_gg(
x = doc_section_1, value = gg,
width = 9, height = 6,
style = "centered")
However, I get the following error when I attempt this using a landscape orientation template (i.e. read_docx(path = <a path to a template>)
)
! could not match any style named 'centered' in c('Normal', 'header', 'footer')
What is the issue here?
https://ardata-fr.github.io/officeverse/officer-for-word.html#add-sections