summaryrefslogtreecommitdiff
path: root/sheet.go
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2018-11-04 23:28:39 +0800
committerGitHub <noreply@github.com>2018-11-04 23:28:39 +0800
commit2aca340f5d8358828f2d6c889d50fd34693ecfe7 (patch)
tree35be12e2af1a238a7dc6b8210603ae67541a622d /sheet.go
parent4dbc78ce0a0d40be189b4c77207cdbb598846c73 (diff)
parent51857a217d6eec867d70f948104177e728c19bf5 (diff)
Merge pull request #287 from q523591/unprotect-sheet
New function `UnprotectSheet()` has been added
Diffstat (limited to 'sheet.go')
-rw-r--r--sheet.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/sheet.go b/sheet.go
index 8ddb8c9..9861d20 100644
--- a/sheet.go
+++ b/sheet.go
@@ -713,7 +713,7 @@ func (f *File) SearchSheet(sheet, value string) []string {
// ProtectSheet provides a function to prevent other users from accidentally
// or deliberately changing, moving, or deleting data in a worksheet. For
-// example protect Sheet1 with protection settings:
+// example, protect Sheet1 with protection settings:
//
// xlsx.ProtectSheet("Sheet1", &excelize.FormatSheetProtection{
// Password: "password",
@@ -752,6 +752,12 @@ func (f *File) ProtectSheet(sheet string, settings *FormatSheetProtection) {
}
}
+// UnprotectSheet provides a function to unprotect an Excel worksheet.
+func (f *File) UnprotectSheet(sheet string) {
+ xlsx := f.workSheetReader(sheet)
+ xlsx.SheetProtection = nil
+}
+
// trimSheetName provides a function to trim invaild characters by given worksheet
// name.
func trimSheetName(name string) string {