
Last chance! 50% off unlimited learning
Sale ends in
Retrieves or creates cell styles in workbook
s.
# S4 method for workbook,character
getOrCreateCellStyle(object,name)
The workbook
to use
The name of the cellstyle
to retrieve or to create
Martin Studer
Mirai Solutions GmbH https://mirai-solutions.ch
Retrieves an existing cellstyle
if it exists or creates a new one if it
does not exist yet.
workbook
, cellstyle
, setCellStyle
,
createCellStyle
, existsCellStyle
if (FALSE) {
# Load workbook (create if not existing)
wb <- loadWorkbook("getOrCreateCellStyle.xlsx", create = TRUE)
# The first time, the style does not exist yet and gets created
myStyle <- getOrCreateCellStyle(wb, name = "MyStyle")
# The second time, we retrieve the already existing style
myStyle <- getOrCreateCellStyle(wb, name = "MyStyle")
# clean up
file.remove("getOrCreateCellStyle.xlsx")
}
Run the code above in your browser using DataLab