View source: R/ooxml_block_objects.R
| block_caption | R Documentation |
Create a representation of a caption that can be used for cross reference.
block_caption(label, style = NULL, autonum = NULL)
label |
a scalar character representing label to display |
style |
paragraph style name |
autonum |
an object generated with function run_autonum |
Other block functions for reporting:
block_gg(),
block_list(),
block_pour_docx(),
block_section(),
block_table(),
block_toc(),
fpar(),
plot_instr(),
unordered_list()
library(officer)
run_num <- run_autonum(seq_id = "tab", pre_label = "tab. ",
bkm = "mtcars_table")
caption <- block_caption("mtcars table",
style = "Normal",
autonum = run_num
)
doc_1 <- read_docx()
doc_1 <- body_add(doc_1, "A title", style = "heading 1")
doc_1 <- body_add(doc_1, "Hello world!", style = "Normal")
doc_1 <- body_add(doc_1, caption)
doc_1 <- body_add(doc_1, mtcars, style = "table_template")
print(doc_1, target = tempfile(fileext = ".docx"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.