fp_bold <- fp_text_lite(bold = TRUE)
fp_red <- fp_text_lite(color = "red")
bl <- block_list(
fpar(ftext("Comment multiple words.", fp_bold)),
fpar(
ftext("Second line.", fp_red)
)
)
comment1 <- run_comment(
cmt = bl,
run = ftext("with a comment"),
author = "Author Me",
date = Sys.Date(),
initials = "AM"
)
par1 <- fpar("A paragraph ", comment1)
bl <- block_list(
fpar(ftext("Comment a paragraph."))
)
comment2 <- run_comment(
cmt = bl, run = ftext("A commented paragraph"),
author = "Author You",
date = Sys.Date(),
initials = "AY"
)
par2 <- fpar(comment2)
doc <- read_docx()
doc <- body_add_fpar(doc, value = par1, style = "Normal")
doc <- body_add_fpar(doc, value = par2, style = "Normal")
print(doc, target = tempfile(fileext = ".docx"))
Run the code above in your browser using DataLab