So I am working on creating an automated powerpoint report in R using the officer package. I want to create a bulleted list with numerous levels but I need to be able to have specific text formatting for each line (i.e. I want the first two words to be green while the rest of the line is black). I tried using unordered_list() but this command doesn't allow the specific text formatting I need. I've tried the code below which colors/bolds the text that I want, but ph_add_par(level = ) does not indent the bullet points.
Is there a way that I can format the text how I want while also being able to manipulate the bullet point levels? I want it to look something like this:
library(officer)
report <- read_pptx()
sprint_1 <- sprintf("%s total crimes in %s %s",
tc20, params$month, params$year)
report%>%
add_slide(layout = 'Title and Content', master = 'Office Theme')%>%
ph_with(value = "Academy: Summary Notes", location = ph_location_type(type = "title"))%>%
ph_empty(location = ph_location_type("body")) %>%
ph_add_par(level = 1L)%>%
ph_add_text(str = sprint_1, style = fp_text(color = "black", font.size = 28, bold = TRUE, underlined = TRUE))%>%
ph_add_par(level = 2L)%>%
ph_add_text(str = paste("compared to this time in ", params$pastyear, " (", tc_ytd19, " total crimes)", sep = ""),
style = fp_text(color = 'black', font.size = 24)) %>%
ph_add_text(str = paste(pct_chg_mth, "change", sep = " "),
style = fp_text(color = "green", font.size = 24)) -> report