Create and set cell styles.

CellStyle(
  wb,
  dataFormat = NULL,
  alignment = NULL,
  border = NULL,
  fill = NULL,
  font = NULL,
  cellProtection = NULL
)

is.CellStyle(x)

# S3 method for default
CellStyle(
  wb,
  dataFormat = NULL,
  alignment = NULL,
  border = NULL,
  fill = NULL,
  font = NULL,
  cellProtection = NULL
)

setCellStyle(cell, cellStyle)

getCellStyle(cell)

Arguments

wb

a workbook object as returned by createWorkbook or loadWorkbook.

dataFormat

a DataFormat object.

alignment

a Alignment object.

border

a Border object.

fill

a Fill object.

font

a Font object.

cellProtection

a CellProtection object.

x

a CellStyle object.

cell

a Cell object.

cellStyle

a CellStyle object.

Value

createCellStyle creates a CellStyle object. is.CellStyle returns TRUE if the argument is of class "CellStyle" and FALSE otherwise.

Details

setCellStyle sets the CellStyle to one Cell object.

You need to have a Workbook object to attach a CellStyle object to it.

Since OS X 10.5 Apple dropped support for AWT on the main thread, so essentially you cannot use any graphics classes in R on OS X 10.5 since R is single-threaded. (verbatim from Simon Urbanek). This implies that setting colors on Mac will not work as is! A set of about 50 basic colors are still available please see the javadocs.

For Excel 95/2000/XP/2003 the choice of colors is limited. See INDEXED_COLORS_ for the list of available colors.

Unspecified values for arguments are taken from the system locale.

Author

Adrian Dragulescu

Examples


if (FALSE) {
  wb <- createWorkbook()
  sheet <- createSheet(wb, "Sheet1")

  rows  <- createRow(sheet, rowIndex=1)

  cell.1 <- createCell(rows, colIndex=1)[[1,1]]
  setCellValue(cell.1, "Hello R!")

  cs <- CellStyle(wb) +
    Font(wb, heightInPoints=20, isBold=TRUE, isItalic=TRUE,
      name="Courier New", color="orange") +
    Fill(backgroundColor="lavender", foregroundColor="lavender",
      pattern="SOLID_FOREGROUND") +
    Alignment(h="ALIGN_RIGHT")

  setCellStyle(cell.1, cellStyle1)

  # you need to save the workbook now if you want to see this art
}