Hi there I want to be able to change the style, font, and color of my text in body_add_par from the officer package. Is there a simple way to do this?
Note: I was able to change the font, size, and color) using fp_text (see directly below) but then it wouldnt let me keep the styles ("heading" or "normal")
format_paragraph <- fp_text(font.family='Arial', font.size=10, color = "black") format_title <- fp_text(font.family='Arial', font.size=12, color = "red")
data <- structure(list(Site = "Waterbody1", `Water Quality Paragraph` = "Water temperature was 9.9°C, conductivity was 6.9 microseimens per centimetre (uS/cm), and pH was 7.9. The dissolved oxygen concentration was 8.9 mg/L, which was above the guideline for protection of aquatic life (6.5 mg/L) (CCME 1999) and suitable for most fish species."), row.names = c(NA,
-1L), class = "data.frame")
Example input:
library(officer)
library(tidyverse)
# create empty Word file
sample_doc <- read_docx()
#Waterbody 1
sample_doc <- sample_doc %>% body_add_par(data$Site, style = "heading 1")
sample_doc <- sample_doc %>% body_add_par(data$`Water Quality Paragraph`, style = "Normal")
print(sample_doc, target = "sample_file.docx")
Desired Output (