officer (version 0.2.0)

body_replace_at: replace text at a bookmark location

Description

replace text content enclosed in a bookmark with different text. A bookmark will be considered as valid if enclosing words within a paragraph; i.e., a bookmark along two or more paragraphs is invalid, a bookmark set on a whole paragraph is also invalid, but bookmarking few words inside a paragraph is valid.

Usage

body_replace_at(x, bookmark, value)

Arguments

x

a docx device

bookmark

bookmark id

value

the replacement string, of type character

Examples

Run this code
# NOT RUN {
library(magrittr)
doc <- read_docx() %>%
  body_add_par("centered text", style = "centered") %>%
  slip_in_text(". How are you", style = "strong") %>%
  body_bookmark("text_to_replace") %>%
  body_replace_at("text_to_replace", "not left aligned")
# }

Run the code above in your browser using DataCamp Workspace