Learn R Programming

XLConnect (version 1.0.7)

createFreezePane-methods: Creating a freeze pane on a worksheet

Description

Creates a freeze pane on a specified worksheet.

Usage

# S4 method for workbook,character
createFreezePane(object, sheet, colSplit, rowSplit, leftColumn, topRow)
# S4 method for workbook,numeric
createFreezePane(object, sheet, colSplit, rowSplit, leftColumn, topRow)

Arguments

object

The workbook to use

sheet

The name or index of the sheet on which to create a freeze pane

colSplit

Horizontal position of freeze (as column index or name)

rowSplit

Vertical position of freeze (as number of rows)

leftColumn

Left column (as column index or name) visible in right pane. If not specified, the default is leftColumn=colSplit

topRow

Top row (as index) visible in bottom pane. If not specified, the default is topRow=rowSplit

Author

Nicola Lambiase
Mirai Solutions GmbH https://mirai-solutions.ch

References

How to create a freeze pane/split pane in Office 2007 https://support.microsoft.com/en-us/office/freeze-panes-to-lock-rows-and-columns-dab2ffc9-020d-4026-8121-67dd25f2508f?ocmsassetid=hp001217048&correlationid=b4f5baeb-b622-4487-a96f-514d2f00208a&ui=en-us&rs=en-us&ad=us

See Also

workbook createSplitPane removePane

Examples

Run this code
if (FALSE) {
# Load workbook (create if not existing)
wb <- loadWorkbook("freezePaneTest.xlsx", create = TRUE)

# Create a worksheet named 'Sheet1'
createSheet(wb, name = "Sheet1")

# Create a freeze pane on Sheet1, using as reference position the 5th column and the 5th row,
# showing the 10th column as the leftmost visible one in the right pane
# and the 10th row as the top visible one in the bottom pane.
createFreezePane(wb, "Sheet1", 5, 5, 10, 10)

# Save workbook (this actually writes the file to disk)
saveWorkbook(wb)

# clean up 
file.remove("freezePaneTest.xlsx")
}

Run the code above in your browser using DataLab