Set worksheet row heights
setRowHeights(
wb,
sheet,
rows,
heights,
fontsize = NULL,
factor = 1,
base_height = 15,
extra_height = 12,
wrap = TRUE
)
workbook object
name or index of a worksheet
indices of rows to set height
heights to set rows to specified in Excel column height units
font size, optional (get base font size by default)
factor to manually adjust font width, e.g., for bold fonts, optional
basic row height, optional
additional row height per new line of text, optional
wrap text of entries which exceed the column width, optional
## Create a new workbook
wb <- createWorkbook()
## Add a worksheet
addWorksheet(wb, "Sheet")
sheet <- 1
## Write dummy data
writeData(wb, sheet, "fixed w/fixed h", startCol = 1, startRow = 1)
writeData(wb, sheet, "fixed w/auto h ABC ABC ABC ABC ABC ABC ABC ABC ABC ABC ABC",
startCol = 2, startRow = 2)
writeData(wb, sheet, "variable w/fixed h", startCol = 3, startRow = 3)
## Set column widths and row heights
setColWidths(wb, sheet, cols = c(1, 2, 3, 4), widths = c(10, 20, "auto", 20))
setRowHeights(wb, sheet, rows = c(1, 2, 8, 4, 6), heights = c(30, "auto", 15, 15, 30))
## Overwrite row 1 height
setRowHeights(wb, sheet, rows = 1, heights = 40)
## Save workbook
if (FALSE) { # \dontrun{
saveWorkbook(wb, "setRowHeightsExample.xlsx", overwrite = TRUE)
} # }