
Last chance! 50% off unlimited learning
Sale ends in
Specifies borders for a cellstyle
.
# S4 method for cellstyle
setBorder(object,side,type,color)
The cellstyle
to edit
A vector with any combination of {"bottom", "left", "right", "top", "all"}
Specifies the border type to be used - it is normally
specified by a corresponding XLC
constant (see the
XLC
border constant,
e.g. XLC$"BORDER.MEDIUM_DASHED"
)
Defines the border color and is normally also specified
via an XLC
constant.
Martin Studer
Mirai Solutions GmbH https://mirai-solutions.ch
Specifies the border for a cellstyle
. Note that the arguments
type
and color
should be of the same length as side. In
other words, for each specified side
there should be a
corresponding specification of type
and color
. If this is
not the case the arguments will be automatically replicated to the
length of side
.
workbook
, cellstyle
, setCellStyle
,
setStyleAction
, XLC
if (FALSE) {
# Load workbook (create if not existing)
wb <- loadWorkbook("setBorder.xlsx", create = TRUE)
# Create a worksheet
createSheet(wb, name = "cellstyles")
# Create a custom anonymous cell style
cs <- createCellStyle(wb)
# Specify the border for the cell style created above
setBorder(cs, side = c("bottom", "right"), type = XLC$"BORDER.THICK",
color = c(XLC$"COLOR.BLACK", XLC$"COLOR.RED"))
# 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("setBorder.xlsx")
}
Run the code above in your browser using DataLab