officer (version 0.3.4)

change_styles: replace paragraphs styles

Description

Replace styles with others in a Word document.

Usage

change_styles(x, mapstyles)

Arguments

x

an rdocx object

mapstyles

a named list, names are the replacement style, content (as a character vector) are the styles to be replaced.

Examples

Run this code
# NOT RUN {
library(magrittr)

mapstyles <- list( "centered" = c("Normal"),
    "heading 3" = c("heading 1", "heading 2") )
doc <- read_docx() %>%
  body_add_par("A title", style = "heading 1") %>%
  body_add_par("Another title", style = "heading 2") %>%
  body_add_par("Hello world!", style = "Normal") %>%
  change_styles( mapstyles = mapstyles )

print(doc, target = tempfile(fileext = ".docx"))
# }

Run the code above in your browser using DataLab