From 4dbc78ce0a0d40be189b4c77207cdbb598846c73 Mon Sep 17 00:00:00 2001 From: HcySunYang Date: Fri, 2 Nov 2018 23:08:31 +0800 Subject: resolve #273 new feature: protect sheet support new feature: protect sheet support, relate issue #273 --- xmlWorksheet.go | 61 ++++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 20 deletions(-) (limited to 'xmlWorksheet.go') diff --git a/xmlWorksheet.go b/xmlWorksheet.go index 072ecce..42f8ddb 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -377,26 +377,27 @@ type xlsxF struct { // xlsxSheetProtection collection expresses the sheet protection options to // enforce when the sheet is protected. type xlsxSheetProtection struct { - AlgorithmName string `xml:"algorithmName,attr,omitempty"` - AutoFilter int `xml:"autoFilter,attr,omitempty"` - DeleteColumns int `xml:"deleteColumns,attr,omitempty"` - DeleteRows int `xml:"deleteRows,attr,omitempty"` - FormatCells int `xml:"formatCells,attr,omitempty"` - FormatColumns int `xml:"formatColumns,attr,omitempty"` - FormatRows int `xml:"formatRows,attr,omitempty"` - HashValue string `xml:"hashValue,attr,omitempty"` - InsertColumns int `xml:"insertColumns,attr,omitempty"` - InsertHyperlinks int `xml:"insertHyperlinks,attr,omitempty"` - InsertRows int `xml:"insertRows,attr,omitempty"` - Objects int `xml:"objects,attr,omitempty"` - PivotTables int `xml:"pivotTables,attr,omitempty"` - SaltValue string `xml:"saltValue,attr,omitempty"` - Scenarios int `xml:"scenarios,attr,omitempty"` - SelectLockedCells int `xml:"selectLockedCells,attr,omitempty"` - SelectUnlockedCell int `xml:"selectUnlockedCell,attr,omitempty"` - Sheet int `xml:"sheet,attr,omitempty"` - Sort int `xml:"sort,attr,omitempty"` - SpinCount int `xml:"spinCount,attr,omitempty"` + AlgorithmName string `xml:"algorithmName,attr,omitempty"` + AutoFilter bool `xml:"autoFilter,attr,omitempty"` + DeleteColumns bool `xml:"deleteColumns,attr,omitempty"` + DeleteRows bool `xml:"deleteRows,attr,omitempty"` + FormatCells bool `xml:"formatCells,attr,omitempty"` + FormatColumns bool `xml:"formatColumns,attr,omitempty"` + FormatRows bool `xml:"formatRows,attr,omitempty"` + HashValue string `xml:"hashValue,attr,omitempty"` + InsertColumns bool `xml:"insertColumns,attr,omitempty"` + InsertHyperlinks bool `xml:"insertHyperlinks,attr,omitempty"` + InsertRows bool `xml:"insertRows,attr,omitempty"` + Objects bool `xml:"objects,attr,omitempty"` + Password string `xml:"password,attr,omitempty"` + PivotTables bool `xml:"pivotTables,attr,omitempty"` + SaltValue string `xml:"saltValue,attr,omitempty"` + Scenarios bool `xml:"scenarios,attr,omitempty"` + SelectLockedCells bool `xml:"selectLockedCells,attr,omitempty"` + SelectUnlockedCells bool `xml:"selectUnlockedCells,attr,omitempty"` + Sheet bool `xml:"sheet,attr,omitempty"` + Sort bool `xml:"sort,attr,omitempty"` + SpinCount int `xml:"spinCount,attr,omitempty"` } // xlsxPhoneticPr (Phonetic Properties) represents a collection of phonetic @@ -599,3 +600,23 @@ type formatConditional struct { MultiRange string `json:"multi_range,omitempty"` BarColor string `json:"bar_color,omitempty"` } + +// FormatSheetProtection directly maps the settings of worksheet protection. +type FormatSheetProtection struct { + AutoFilter bool + DeleteColumns bool + DeleteRows bool + EditObjects bool + EditScenarios bool + FormatCells bool + FormatColumns bool + FormatRows bool + InsertColumns bool + InsertHyperlinks bool + InsertRows bool + Password string + PivotTables bool + SelectLockedCells bool + SelectUnlockedCells bool + Sort bool +} -- cgit v1.2.1