Skip to contents

A combined function for setting cursor position with officer::cursor_reach(), officer::cursor_bookmark(), or using a doc_index value from officer::docx_summary(). Defaults to using officer::cursor_end(), officer::cursor_begin(), officer::cursor_backward(), or officer::cursor_forward() if keyword, id, and index are all NULL.

Usage

cursor_docx(
  docx,
  keyword = NULL,
  id = NULL,
  index = NULL,
  default = "end",
  quiet = FALSE,
  call = caller_env()
)

Arguments

docx

A rdocx object.

keyword, id

A keyword string used to place cursor with officer::cursor_reach() or bookmark id with officer::cursor_bookmark(). Defaults to NULL. If keyword or id are not provided, the gt object is inserted at the front of the document.

index

A integer matching a doc_index value appearing in a summary of the docx object created with officer::docx_summary(). If index is for a paragraph value, the text of the pargraph is used as a keyword.

default

Character string with one of the following options: c("end", "begin", "backward", "forward") to set cursor position. Only used if keyword, id, and index are all NULL.

quiet

If FALSE (default) warn when keyword is not found.

call

The execution environment of a currently running function, e.g. caller_env(). The function will be mentioned in error messages as the source of the error. See the call argument of abort() for more information.