setFillForegroundColor-methods: Specifying the fill foreground color for cell styles

setFillForegroundColor-methodsR Documentation

Specifying the fill foreground color for cell styles

Description

Specifies the fill foreground color for a cellstyle.

Usage

## S4 method for signature 'cellstyle,numeric'
setFillForegroundColor(object,color)

Arguments

object

The cellstyle to manipulate

color

The fill foreground color to use for the cellstyle. The color is normally specified via a corresponding color constant from the XLC object.

Author(s)

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

See Also

workbook, cellstyle, setCellStyle, setStyleAction, XLC

Examples

## Not run: 
# Load workbook (create if not existing)
wb <- loadWorkbook("setFillForegroundColor.xlsx", create = TRUE)

# Create a worksheet
createSheet(wb, name = "cellstyles")

# Create a custom anonymous cell style
cs <- createCellStyle(wb)

# Specify the fill background color for the cell style created above
setFillBackgroundColor(cs, color = XLC$"COLOR.CORNFLOWER_BLUE")

# Specify the fill foreground color
setFillForegroundColor(cs, color = XLC$"COLOR.YELLOW")

# Specify the fill pattern
setFillPattern(cs, fill = XLC$"FILL.BIG_SPOTS")

# Set the cell style created above for the top left cell (A1) in the
# 'cellstyles' worksheet
setCellStyle(wb, sheet = "cellstyles", row = 1, col = 1, cellstyle = cs)

# Save the workbook
saveWorkbook(wb)

# clean up 
file.remove("setFillForegroundColor.xlsx")

## End(Not run)

miraisolutions/xlconnect documentation built on April 14, 2024, 10:34 a.m.