body_add_blocks | R Documentation |
add a list of blocks produced by block_list
into
into an rdocx object.
body_add_blocks(x, blocks, pos = "after")
x |
an rdocx object |
blocks |
set of blocks to be used as footnote content returned by
function |
pos |
where to add the new element relative to the cursor, one of "after", "before", "on". |
Other functions for adding content:
body_add_break()
,
body_add_caption()
,
body_add_docx()
,
body_add_fpar()
,
body_add_gg()
,
body_add_img()
,
body_add_par()
,
body_add_plot()
,
body_add_table()
,
body_add_toc()
library(officer)
img.file <- file.path(R.home("doc"), "html", "logo.jpg")
bl <- block_list(
fpar(ftext("hello", shortcuts$fp_bold(color = "red"))),
fpar(
ftext("hello world", shortcuts$fp_bold()),
external_img(src = img.file, height = 1.06, width = 1.39),
fp_p = fp_par(text.align = "center")
)
)
doc_1 <- read_docx()
doc_1 <- body_add_blocks(doc_1, blocks = bl)
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.