Learn R Programming

openxlsx2 (version 0.8)

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",
  apply_alignment = NULL,
  apply_border = NULL,
  apply_fill = NULL,
  apply_font = NULL,
  apply_number_format = NULL,
  apply_protection = NULL,
  border_id = NULL,
  ext_lst = NULL,
  fill_id = NULL,
  font_id = NULL,
  hidden = NULL,
  horizontal = NULL,
  indent = NULL,
  justify_last_line = NULL,
  locked = NULL,
  num_fmt_id = NULL,
  pivot_button = NULL,
  quote_prefix = NULL,
  reading_order = NULL,
  relative_indent = NULL,
  shrink_to_fit = NULL,
  text_rotation = NULL,
  vertical = NULL,
  wrap_text = NULL,
  xf_id = NULL,
  ...
)

Value

The wbWorksheetObject, invisibly

Arguments

wb

a workbook

sheet

the worksheet

dims

the cell range

apply_alignment

logical apply alignment

apply_border

logical apply border

apply_fill

logical apply fill

apply_font

logical apply font

apply_number_format

logical apply number format

apply_protection

logical apply protection

border_id

border ID to apply

ext_lst

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

fill_id

fill ID to apply

font_id

font ID to apply

hidden

logical cell is hidden

horizontal

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

indent

logical indent content

justify_last_line

logical justify last line

locked

logical cell is locked

num_fmt_id

number format ID to apply

pivot_button

unknown

quote_prefix

unknown

reading_order

reading order left to right

relative_indent

relative indentation

shrink_to_fit

logical shrink to fit

text_rotation

degrees of text rotation

vertical

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

wrap_text

wrap text in cell

xf_id

xf ID to apply

...

additional arguments

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