
Set cursor position in rdocx object based on keyword, id, or index
Source:R/cursor_docx.R
cursor_docx.RdA 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 withofficer::cursor_bookmark(). Defaults toNULL. 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 allNULL.- 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 thecallargument ofabort()for more information.