summaryrefslogtreecommitdiff
path: root/xmlWorksheet.go
diff options
context:
space:
mode:
Diffstat (limited to 'xmlWorksheet.go')
-rw-r--r--xmlWorksheet.go108
1 files changed, 82 insertions, 26 deletions
diff --git a/xmlWorksheet.go b/xmlWorksheet.go
index 87d66a1..d35b40e 100644
--- a/xmlWorksheet.go
+++ b/xmlWorksheet.go
@@ -1,3 +1,12 @@
+// Copyright 2016 - 2018 The excelize Authors. All rights reserved. Use of
+// this source code is governed by a BSD-style license that can be found in
+// the LICENSE file.
+//
+// Package excelize providing a set of functions that allow you to write to
+// and read from XLSX files. Support reads and writes XLSX file generated by
+// Microsoft Excelâ„¢ 2007 and later. Support save file without losing original
+// charts of XLSX. This library needs Go version 1.8 or later.
+
package excelize
import "encoding/xml"
@@ -18,7 +27,7 @@ type xlsxWorksheet struct {
MergeCells *xlsxMergeCells `xml:"mergeCells"`
PhoneticPr *xlsxPhoneticPr `xml:"phoneticPr"`
ConditionalFormatting []*xlsxConditionalFormatting `xml:"conditionalFormatting"`
- DataValidations *xlsxDataValidations `xml:"dataValidations"`
+ DataValidations *xlsxDataValidations `xml:"dataValidations,omitempty"`
Hyperlinks *xlsxHyperlinks `xml:"hyperlinks"`
PrintOptions *xlsxPrintOptions `xml:"printOptions"`
PageMargins *xlsxPageMargins `xml:"pageMargins"`
@@ -202,6 +211,13 @@ type xlsxSheetPr struct {
TransitionEntry bool `xml:"transitionEntry,attr,omitempty"`
TabColor *xlsxTabColor `xml:"tabColor,omitempty"`
PageSetUpPr *xlsxPageSetUpPr `xml:"pageSetUpPr,omitempty"`
+ OutlinePr *xlsxOutlinePr `xml:"outlinePr,omitempty"`
+}
+
+// xlsxOutlinePr maps to the outlinePr element
+// SummaryBelow allows you to adjust the direction of grouper controls
+type xlsxOutlinePr struct {
+ SummaryBelow bool `xml:"summaryBelow,attr"`
}
// xlsxPageSetUpPr directly maps the pageSetupPr element in the namespace
@@ -294,11 +310,30 @@ type xlsxMergeCells struct {
// xlsxDataValidations expresses all data validation information for cells in a
// sheet which have data validation features applied.
type xlsxDataValidations struct {
- Count int `xml:"count,attr,omitempty"`
- DisablePrompts bool `xml:"disablePrompts,attr,omitempty"`
- XWindow int `xml:"xWindow,attr,omitempty"`
- YWindow int `xml:"yWindow,attr,omitempty"`
- DataValidation string `xml:",innerxml"`
+ Count int `xml:"count,attr,omitempty"`
+ DisablePrompts bool `xml:"disablePrompts,attr,omitempty"`
+ XWindow int `xml:"xWindow,attr,omitempty"`
+ YWindow int `xml:"yWindow,attr,omitempty"`
+ DataValidation []*DataValidation `xml:"dataValidation"`
+}
+
+// DataValidation directly maps the a single item of data validation defined
+// on a range of the worksheet.
+type DataValidation struct {
+ AllowBlank bool `xml:"allowBlank,attr"`
+ Error *string `xml:"error,attr"`
+ ErrorStyle *string `xml:"errorStyle,attr"`
+ ErrorTitle *string `xml:"errorTitle,attr"`
+ Operator string `xml:"operator,attr"`
+ Prompt *string `xml:"prompt,attr"`
+ PromptTitle *string `xml:"promptTitle"`
+ ShowDropDown bool `xml:"showDropDown,attr"`
+ ShowErrorMessage bool `xml:"showErrorMessage,attr"`
+ ShowInputMessage bool `xml:"showInputMessage,attr"`
+ Sqref string `xml:"sqref,attr"`
+ Type string `xml:"type,attr"`
+ Formula1 string `xml:"formula1"`
+ Formula2 string `xml:"formula2"`
}
// xlsxC directly maps the c element in the namespace
@@ -349,26 +384,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
@@ -571,3 +607,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
+}