hideSheet-methods: Hiding worksheets in a workbook

Description Usage Arguments Details Note Author(s) See Also Examples

Description

(Very) hides the specified worksheets in a workbook.

Usage

1
2
3
4
## S4 method for signature 'workbook,character'
hideSheet(object, sheet, veryHidden)
## S4 method for signature 'workbook,numeric'
hideSheet(object, sheet, veryHidden)

Arguments

object

The workbook to use

sheet

The name or index of the sheet to hide

veryHidden

If veryHidden = TRUE, the specified sheet is "very" hidden (see note), otherwise it is just hidden. Default is FALSE.

Details

The arguments sheet and veryHidden are vectorized such that multiple worksheets can be (very) hidden with one method call. An exception is thrown if the specified sheet does not exist.

Note

Note that hidden worksheets can be unhidden by users directly within Excel via standard functionality. Therefore Excel knows the concept of "very hidden" worksheets. These worksheets cannot be unhidden with standard Excel functionality but need programatic intervention to be made visible.

Also note that in case the specified worksheet to hide is the currently active worksheet, then hideSheet tries to set the active worksheet to the first non-hidden (not hidden and not very hidden) worksheet in the workbook. If there is no such worksheet, hideSheet will throw an exception.

Author(s)

Martin Studer
Mirai Solutions GmbH http://www.mirai-solutions.com

See Also

workbook, unhideSheet, isSheetHidden, isSheetVeryHidden, isSheetVisible

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# Load workbook (create if not existing)
wb <- loadWorkbook("hiddenWorksheet.xlsx", create = TRUE)

# Write a couple of built-in data.frame's into sheets
# with corresponding name
for(obj in c("CO2", "airquality", "swiss")) {
  createSheet(wb, name = obj)
  writeWorksheet(wb, get(obj), sheet = obj)
}

# Hide sheet 'airquality';
# the sheet may be unhidden by a user from within Excel
# since veryHidden defaults to FALSE
hideSheet(wb, sheet = "airquality")

# Save workbook
saveWorkbook(wb)

XLConnect documentation built on May 29, 2017, 7:04 p.m.

Search within the XLConnect package
Search all R packages, documentation and source code