getOrCreateCellStyle-methods: Retrieving or creating named cell styles

Description Usage Arguments Details Author(s) See Also Examples

Description

Retrieves or creates cell styles in workbooks.

Usage

1
2
## S4 method for signature 'workbook,character'
getOrCreateCellStyle(object,name)

Arguments

object

The workbook to use

name

The name of the cellstyle to retrieve or to create

Details

Retrieves an existing cellstyle if it exists or creates a new one if it does not exist yet.

Author(s)

Martin Studer
Mirai Solutions GmbH https://mirai-solutions.ch

See Also

workbook, cellstyle, setCellStyle, createCellStyle, existsCellStyle

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
# 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")

## End(Not run)

XLConnect documentation built on April 11, 2021, 9:06 a.m.