getCellStyleForType-methods

0th

Percentile

Querying the cell style per data type for the DATATYPE style action

Queries the cell style for a specific data type as used by the DATATYPE style action.

Keywords
methods, utilities
Usage
# S4 method for workbook
getCellStyleForType(object,type)
Arguments
object

The '>workbook to use

type

The data type for which to get the '>cellstyle.

Details

Based on the (cell) data type the DATATYPE style action (see setStyleAction) sets the '>cellstyle for the corresponding cells. The data type is normally specified via a corresponding data type constant from the XLC object.

See Also

'>workbook, setCellStyleForType, setStyleAction

Aliases
  • getCellStyleForType
  • getCellStyleForType-methods
  • getCellStyleForType,workbook-method
Examples
# NOT RUN {
file.copy(system.file("demoFiles/template2.xlsx", 
                      package = "XLConnect"),
          "datatype.xlsx", overwrite = TRUE)

# Load workbook
wb <- loadWorkbook("datatype.xlsx")

# Get current (existing) cell style for numerics
cs <- getCellStyleForType(wb, XLC$"DATA_TYPE.NUMERIC")
# Could also say cs <- getCellStyleForType(wb, "numeric")

# Change style
setBorder(cs, side = c("bottom", "right"), type = XLC$"BORDER.THICK", 
          color = c(XLC$"COLOR.BLACK", XLC$"COLOR.RED"))
          
# Set style action to 'datatype'
setStyleAction(wb, XLC$"STYLE_ACTION.DATATYPE")

# Write built-in data set 'mtcars' to the named region 
# 'mtcars' as defined by the Excel template.
writeNamedRegion(wb, mtcars, name = "mtcars")

# Save workbook
saveWorkbook(wb)
# }
Documentation reproduced from package XLConnect, version 0.2-15, License: GPL-3

Community examples

Looks like there are no examples yet.