CellStyle: Functions to manipulate cells.

Description Usage Arguments Details Value Author(s) Examples

View source: R/CellStyle.R

Description

Create and set cell styles.

Usage

1
2
3
4
5
6
7
8
9
## Default S3 method:
CellStyle(wb, dataFormat=NULL, alignment=NULL,
  border=NULL, fill=NULL, font=NULL, cellProtection=NULL)

setCellStyle(cell, cellStyle)

getCellStyle(cell)

is.CellStyle(x)

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.

...

arguments to CellStyle.default.

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.

Value

createCellStyle creates a CellStyle object.

is.CellStyle returns TRUE if the argument is of class "CellStyle" and FALSE otherwise.

Author(s)

Adrian Dragulescu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
  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

## End(Not run)

colearendt/xlsx documentation built on Oct. 11, 2018, 12:23 a.m.