Learn R Programming

openxlsx2 (version 0.3.1)

wb_add_font: add font for cell region

Description

add font for cell region

Usage

wb_add_font(
  wb,
  sheet = current_sheet(),
  dims = "A1",
  name = "Calibri",
  color = wb_colour(hex = "FF000000"),
  size = "11",
  bold = "",
  italic = "",
  outline = "",
  strike = "",
  underline = "",
  charset = "",
  condense = "",
  extend = "",
  family = "",
  scheme = "",
  shadow = "",
  vertAlign = ""
)

Value

The wbWorksheetObject, invisibly

Arguments

wb

a workbook

sheet

the worksheet

dims

the cell range

name

font name: default "Calibri"

color

rgb color: default "FF000000"

size

font size: default "11",

bold

bold, "single" or "double", default: ""

italic

italic

outline

outline

strike

strike

underline

underline

charset

charset

condense

condense

extend

extend

family

font family

scheme

font scheme

shadow

shadow

vertAlign

vertical alignment

Details

add_font provides all the options openxml accepts for a font node, not all have to be set. Usually name, size and color should be what the user wants.

See Also

Other styles: wb_add_border(), wb_add_cell_style(), wb_add_fill(), 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_font("S1", "A1:K1", name = "Arial", color = wb_colour(theme = "4"))

Run the code above in your browser using DataLab