'does openxlsx offer bullet/key point functionality?
I need to output, using the openxlsx R package, some text rows in bullet point format. There doesn't appear to be a createStyle() option for doing this. Is anyone aware of a way to do this using openxlsx?
Solution 1:[1]
In the absence of reproducible data I've made up a small dataframe. You can do this with excel formulas, using the excel CHAR() function which accesses unicode characters. The example uses a solid dot, but you can use whatever bullet symbol appeals.
library(openxlsx)
dat <- data.frame(txt = c("This is some text", "Oneword", "1 a number"))
dat$bullet <- paste("+CHAR(149)", paste0("\"", dat$txt, "\""), sep = "&")
class(dat$bullet) <- c(class(dat$bullet), "formula")
wb <- createWorkbook()
addWorksheet(wb, "Sheet 1")
writeData(wb, "Sheet 1", x = dat)
saveWorkbook(wb, "bullet-eg.xlsx", overwrite = TRUE)
Which results in:
Created on 2022-05-06 by the reprex package (v2.0.1)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |