Learn R Programming

openxlsx (version 1.0.3)

modifyBaseFont: Modify the default font

Description

Base font is black, size 11, Calibri

Usage

modifyBaseFont(wb, fontSize = 11, fontColour = "#000000",
  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.

Examples

Run this code
## create a workbook
wb <- createWorkbook()
addWorksheet(wb, "S1")
## modify base font to size 10 Arial Narrow in red
modifyBaseFont(wb, fontSize = 10, fontColour = "#FF0000", fontName = "Arial Narrow")

writeData(wb, "S1", iris)
writeDataTable(wb, "S1", x = iris, startCol = 10) ## font colour does not affect tables
saveWorkbook(wb, "modifyBaseFontExample.xlsx", overwrite = TRUE)

Run the code above in your browser using DataLab