Skip to contents

Add a comment on a run object.

Usage

run_comment(
  cmt,
  run = ftext(""),
  author = "",
  date = "",
  initials = "",
  prop = NULL
)

Arguments

cmt

a set of blocks to be used as comment content returned by function block_list(). the "run functions for reporting".

run

a run object, made with a call to one of

author

comment author.

date

comment date

initials

comment initials

prop

formatting text properties returned by fp_text_lite() or fp_text(). It also can be NULL in which case, no formatting is defined (the default is applied).

Examples

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"))