Learn R Programming

openxlsx2 (version 0.4.1)

wb_freeze_pane: Freeze a worksheet pane

Description

Freeze a worksheet pane

Usage

wb_freeze_pane(
  wb,
  sheet = current_sheet(),
  firstActiveRow = NULL,
  firstActiveCol = NULL,
  firstRow = FALSE,
  firstCol = FALSE
)

Arguments

wb

A workbook object

sheet

A name or index of a worksheet

firstActiveRow

Top row of active region

firstActiveCol

Furthest left column of active region

firstRow

If TRUE, freezes the first row (equivalent to firstActiveRow = 2)

firstCol

If TRUE, freezes the first column (equivalent to firstActiveCol = 2)

See Also

Other workbook wrappers: wb_add_chartsheet(), wb_add_data_table(), wb_add_data(), wb_add_formula(), wb_add_worksheet(), wb_clone_worksheet(), wb_creators, wb_get_base_font(), wb_save(), wb_set_col_widths(), wb_set_last_modified_by(), wb_set_row_heights(), wb_workbook(), workbook_grouping, ws_cell_merge

Examples

Run this code
## Create a new workbook
wb <- wb_workbook("Kenshin")

## Add some worksheets
wb$add_worksheet("Sheet 1")
wb$add_worksheet("Sheet 2")
wb$add_worksheet("Sheet 3")
wb$add_worksheet("Sheet 4")

## Freeze Panes
wb$freeze_pane("Sheet 1", firstActiveRow = 5, firstActiveCol = 3)
wb$freeze_pane("Sheet 2", firstCol = TRUE) ## shortcut to firstActiveCol = 2
wb$freeze_pane(3, firstRow = TRUE) ## shortcut to firstActiveRow = 2
wb$freeze_pane(4, firstActiveRow = 1, firstActiveCol = "D")

Run the code above in your browser using DataLab