update_toc | R Documentation |
This function exports the document as a temporary .docx file, creates a temporary .vbs file to update all references of all tables of contents and save, runs the .vbs file in command prompt, overrides x using the 'read_docx()' function of the 'officer' package, deletes the temporary files, and returns the updated .docx file.
update_toc(x)
x |
document created using 'read_docx()' function from 'officer' package |
doc <- read_docx()
doc <- body_add_par(doc, value = "Table of content", style = "heading 1")
doc <- body_add_toc(doc, level = 2)
doc <- body_end_section_continuous(doc)
doc <- body_add_par(doc, value = "Section 1", style = "heading 1")
doc <- body_add_par(doc, value = "This is a test.", style = "heading 2")
doc <- body_add_par(doc, value = "Section 1", style = "heading 1")
doc <- update_toc(doc)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.