Skip to contents

Modify / get the default font for the workbook.

Usage

wb_set_base_font(
  wb,
  font_size = 11,
  font_color = wb_color(theme = "1"),
  font_name = "Calibri",
  ...
)

wb_get_base_font(wb)

Arguments

wb

A workbook object

font_size

font size

font_color

font color

font_name

Name of a font

...

additional arguments

Details

The font name is not validated in anyway. Excel replaces unknown font names with Arial. Base font is black, size 11, Calibri.

Examples

## create a workbook
wb <- wb_workbook()
wb$add_worksheet("S1")
## modify base font to size 10 Arial Narrow in red
wb$set_base_font(fontSize = 10, fontColor = "#FF0000", fontName = "Arial Narrow")

wb$add_data("S1", iris)
wb$add_data_table("S1", x = iris, startCol = 10) ## font color does not affect tables

## get the base font
## create a workbook
wb <- wb_workbook()
wb_get_base_font(wb)
#> $size
#> $size$val
#> [1] "11"
#> 
#> 
#> $color
#> $color$theme
#> [1] "1"
#> 
#> 
#> $name
#> $name$val
#> [1] "Calibri"
#> 
#> 

## modify base font to size 10 Arial Narrow in red
wb$set_base_font(fontSize = 10, fontColor = "#FF0000", fontName = "Arial Narrow")

wb_get_base_font(wb)
#> $size
#> $size$val
#> [1] "10"
#> 
#> 
#> $color
#> $color$rgb
#> [1] "FFFF0000"
#> 
#> 
#> $name
#> $name$val
#> [1] "Arial Narrow"
#> 
#>