Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

replaceStyle

Replace an existing cell style


Description

Replace an existing cell style

Replace a style object

Usage

replaceStyle(wb, index, newStyle)

Arguments

wb

A workbook object

index

Index of style object to replace

newStyle

A style to replace the existing style as position index

Author(s)

Alexander Walker

See Also

Examples

## load a workbook
wb <- loadWorkbook(file = system.file("extdata", "loadExample.xlsx", package = "openxlsx"))

## create a new style and replace style 2

newStyle <- createStyle(fgFill = "#00FF00")

## replace style 2
getStyles(wb)[1:3] ## prints styles
replaceStyle(wb, 2, newStyle = newStyle)

## Save workbook
## Not run: 
saveWorkbook(wb, "replaceStyleExample.xlsx", overwrite = TRUE)

## End(Not run)

openxlsx

Read, Write and Edit xlsx Files

v4.2.3
MIT + file LICENSE
Authors
Philipp Schauberger [aut, cre], Alexander Walker [aut], Luca Braglia [ctb], Joshua Sturm [ctb]
Initial release
2020-10-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.