I'm working on creating .docx documents using officer package. I've got a problem with body_add_toc() function, which creates and empty "table of content" (just a gray rectangle with no actual content). Even the example from the officer vignette doesn't seems to work for me. (I've simplified it a bit)
doc <- read_docx() %>%
body_add_par(value = "Table of content", style = "heading 1") %>%
body_add_toc(level = 2) %>%
body_add_par(value = "Tables", style = "heading 1")
print(doc, target = "toc.docx")
I've already tried to specify the body_add_toc() style argument as "heading" or "heading 1". I've also tried to change the body_add_par() and body_add_toc() style into "toc 1", but none of this solutons have helped me.
I'm working on Ubuntu 16.04, using R 3.4.3, officer 0.2.2 and magrittr 1.5
Thanks in advance for your help! Regards