Learn R Programming

openxlsx2 (version 0.6.1)

wb_add_cell_style: add cell style for cell region

Description

add cell style for cell region

Usage

wb_add_cell_style(
  wb,
  sheet = current_sheet(),
  dims = "A1",
  applyAlignment = NULL,
  applyBorder = NULL,
  applyFill = NULL,
  applyFont = NULL,
  applyNumberFormat = NULL,
  applyProtection = NULL,
  borderId = NULL,
  extLst = NULL,
  fillId = NULL,
  fontId = NULL,
  hidden = NULL,
  horizontal = NULL,
  indent = NULL,
  justifyLastLine = NULL,
  locked = NULL,
  numFmtId = NULL,
  pivotButton = NULL,
  quotePrefix = NULL,
  readingOrder = NULL,
  relativeIndent = NULL,
  shrinkToFit = NULL,
  textRotation = NULL,
  vertical = NULL,
  wrapText = NULL,
  xfId = NULL
)

Value

The wbWorksheetObject, invisibly

Arguments

wb

a workbook

sheet

the worksheet

dims

the cell range

applyAlignment

logical apply alignment

applyBorder

logical apply border

applyFill

logical apply fill

applyFont

logical apply font

applyNumberFormat

logical apply number format

applyProtection

logical apply protection

borderId

border ID to apply

extLst

extension list something like <extLst>...</extLst>

fillId

fill ID to apply

fontId

font ID to apply

hidden

logical cell is hidden

horizontal

align content horizontal ('left', 'center', 'right')

indent

logical indent content

justifyLastLine

logical justify last line

locked

logical cell is locked

numFmtId

number format ID to apply

pivotButton

unknown

quotePrefix

unknown

readingOrder

reading order left to right

relativeIndent

relative indentation

shrinkToFit

logical shrink to fit

textRotation

degrees of text rotation

vertical

vertical alignment of content ('top', 'center', 'bottom')

wrapText

wrap text in cell

xfId

xf ID to apply

See Also

Other styles: wb_add_border(), wb_add_fill(), wb_add_font(), wb_add_numfmt(), wb_clone_sheet_style()

Examples

Run this code
 wb <-
   wb_workbook() %>%
   wb_add_worksheet("S1") %>%
   wb_add_data("S1", mtcars)

 wb %>%
   wb_add_cell_style(
     "S1",
     "A1:K1",
     textRotation = "45",
     horizontal = "center",
     vertical = "center",
     wrapText = "1"
   )

Run the code above in your browser using DataLab