File: protectWorkbook.Rd

package info (click to toggle)
r-cran-openxlsx 4.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,128 kB
  • sloc: cpp: 1,722; ansic: 130; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,185 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/wrappers.R
\name{protectWorkbook}
\alias{protectWorkbook}
\title{Protect a workbook from modifications}
\usage{
protectWorkbook(
  wb,
  protect = TRUE,
  password = NULL,
  lockStructure = FALSE,
  lockWindows = FALSE
)
}
\arguments{
\item{wb}{A workbook object}

\item{protect}{Whether to protect or unprotect the sheet (default=TRUE)}

\item{password}{(optional) password required to unprotect the workbook}

\item{lockStructure}{Whether the workbook structure should be locked}

\item{lockWindows}{Whether the window position of the spreadsheet should be locked}
}
\description{
Protect or unprotect a workbook from modifications by the user in the graphical user interface. Replaces an existing protection.
}
\examples{
wb <- createWorkbook()
addWorksheet(wb, "S1")
protectWorkbook(wb, protect = TRUE, password = "Password", lockStructure = TRUE)
\dontrun{
saveWorkbook(wb, "WorkBook_Protection.xlsx", overwrite = TRUE)
}
# Remove the protection
protectWorkbook(wb, protect = FALSE)
\dontrun{
saveWorkbook(wb, "WorkBook_Protection_unprotected.xlsx", overwrite = TRUE)
}
}
\author{
Reinhold Kainhofer
}