Learn R Programming

openxlsx2 (version 0.3.1)

wb_modify_basefont: Modify the default font

Description

Modify the default font for this workbook

Usage

wb_set_base_font(
  wb,
  fontSize = 11,
  fontColour = wb_colour(theme = "1"),
  fontName = "Calibri"
)

Arguments

wb

A workbook object

fontSize

font size

fontColour

font colour

fontName

Name of a font

Details

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

Examples

Run this code
## 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, fontColour = "#FF0000", fontName = "Arial Narrow")

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

Run the code above in your browser using DataLab