summaryrefslogtreecommitdiff
path: root/xmlWorksheet.go
diff options
context:
space:
mode:
Diffstat (limited to 'xmlWorksheet.go')
-rw-r--r--xmlWorksheet.go505
1 files changed, 374 insertions, 131 deletions
diff --git a/xmlWorksheet.go b/xmlWorksheet.go
index f3323cb..316ffd7 100644
--- a/xmlWorksheet.go
+++ b/xmlWorksheet.go
@@ -1,48 +1,65 @@
-// Copyright 2016 - 2019 The excelize Authors. All rights reserved. Use of
+// Copyright 2016 - 2020 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.
+// charts of XLSX. This library needs Go version 1.10 or later.
package excelize
import "encoding/xml"
// xlsxWorksheet directly maps the worksheet element in the namespace
-// http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have
-// not checked it for completeness - it does as much as I need.
+// http://schemas.openxmlformats.org/spreadsheetml/2006/main.
type xlsxWorksheet struct {
XMLName xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main worksheet"`
SheetPr *xlsxSheetPr `xml:"sheetPr"`
- Dimension xlsxDimension `xml:"dimension"`
- SheetViews xlsxSheetViews `xml:"sheetViews,omitempty"`
+ Dimension *xlsxDimension `xml:"dimension"`
+ SheetViews *xlsxSheetViews `xml:"sheetViews"`
SheetFormatPr *xlsxSheetFormatPr `xml:"sheetFormatPr"`
- Cols *xlsxCols `xml:"cols,omitempty"`
+ Cols *xlsxCols `xml:"cols"`
SheetData xlsxSheetData `xml:"sheetData"`
+ SheetCalcPr *xlsxInnerXML `xml:"sheetCalcPr"`
SheetProtection *xlsxSheetProtection `xml:"sheetProtection"`
+ ProtectedRanges *xlsxInnerXML `xml:"protectedRanges"`
+ Scenarios *xlsxInnerXML `xml:"scenarios"`
AutoFilter *xlsxAutoFilter `xml:"autoFilter"`
+ SortState *xlsxSortState `xml:"sortState"`
+ DataConsolidate *xlsxInnerXML `xml:"dataConsolidate"`
+ CustomSheetViews *xlsxCustomSheetViews `xml:"customSheetViews"`
MergeCells *xlsxMergeCells `xml:"mergeCells"`
PhoneticPr *xlsxPhoneticPr `xml:"phoneticPr"`
ConditionalFormatting []*xlsxConditionalFormatting `xml:"conditionalFormatting"`
- DataValidations *xlsxDataValidations `xml:"dataValidations,omitempty"`
+ DataValidations *xlsxDataValidations `xml:"dataValidations"`
Hyperlinks *xlsxHyperlinks `xml:"hyperlinks"`
PrintOptions *xlsxPrintOptions `xml:"printOptions"`
PageMargins *xlsxPageMargins `xml:"pageMargins"`
PageSetUp *xlsxPageSetUp `xml:"pageSetup"`
HeaderFooter *xlsxHeaderFooter `xml:"headerFooter"`
+ RowBreaks *xlsxBreaks `xml:"rowBreaks"`
+ ColBreaks *xlsxBreaks `xml:"colBreaks"`
+ CustomProperties *xlsxInnerXML `xml:"customProperties"`
+ CellWatches *xlsxInnerXML `xml:"cellWatches"`
+ IgnoredErrors *xlsxInnerXML `xml:"ignoredErrors"`
+ SmartTags *xlsxInnerXML `xml:"smartTags"`
Drawing *xlsxDrawing `xml:"drawing"`
LegacyDrawing *xlsxLegacyDrawing `xml:"legacyDrawing"`
+ LegacyDrawingHF *xlsxLegacyDrawingHF `xml:"legacyDrawingHF"`
+ DrawingHF *xlsxDrawingHF `xml:"drawingHF"`
Picture *xlsxPicture `xml:"picture"`
+ OleObjects *xlsxInnerXML `xml:"oleObjects"`
+ Controls *xlsxInnerXML `xml:"controls"`
+ WebPublishItems *xlsxInnerXML `xml:"webPublishItems"`
TableParts *xlsxTableParts `xml:"tableParts"`
ExtLst *xlsxExtLst `xml:"extLst"`
}
// xlsxDrawing change r:id to rid in the namespace.
type xlsxDrawing struct {
- RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
+ XMLName xml.Name `xml:"drawing"`
+ RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
}
// xlsxHeaderFooter directly maps the headerFooter element in the namespace
@@ -53,49 +70,55 @@ type xlsxDrawing struct {
// footers on the first page can differ from those on odd- and even-numbered
// pages. In the latter case, the first page is not considered an odd page.
type xlsxHeaderFooter struct {
- DifferentFirst bool `xml:"differentFirst,attr,omitempty"`
- DifferentOddEven bool `xml:"differentOddEven,attr,omitempty"`
- OddHeader []*xlsxOddHeader `xml:"oddHeader"`
- OddFooter []*xlsxOddFooter `xml:"oddFooter"`
-}
-
-// xlsxOddHeader directly maps the oddHeader element in the namespace
-// http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have
-// not checked it for completeness - it does as much as I need.
-type xlsxOddHeader struct {
- Content string `xml:",chardata"`
-}
-
-// xlsxOddFooter directly maps the oddFooter element in the namespace
-// http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have
-// not checked it for completeness - it does as much as I need.
-type xlsxOddFooter struct {
- Content string `xml:",chardata"`
+ XMLName xml.Name `xml:"headerFooter"`
+ AlignWithMargins bool `xml:"alignWithMargins,attr,omitempty"`
+ DifferentFirst bool `xml:"differentFirst,attr,omitempty"`
+ DifferentOddEven bool `xml:"differentOddEven,attr,omitempty"`
+ ScaleWithDoc bool `xml:"scaleWithDoc,attr,omitempty"`
+ OddHeader string `xml:"oddHeader,omitempty"`
+ OddFooter string `xml:"oddFooter,omitempty"`
+ EvenHeader string `xml:"evenHeader,omitempty"`
+ EvenFooter string `xml:"evenFooter,omitempty"`
+ FirstFooter string `xml:"firstFooter,omitempty"`
+ FirstHeader string `xml:"firstHeader,omitempty"`
+ DrawingHF *xlsxDrawingHF `xml:"drawingHF"`
+}
+
+// xlsxDrawingHF (Drawing Reference in Header Footer) specifies the usage of
+// drawing objects to be rendered in the headers and footers of the sheet. It
+// specifies an explicit relationship to the part containing the DrawingML
+// shapes used in the headers and footers. It also indicates where in the
+// headers and footers each shape belongs. One drawing object can appear in
+// each of the left section, center section and right section of a header and
+// a footer.
+type xlsxDrawingHF struct {
+ Content string `xml:",innerxml"`
}
// xlsxPageSetUp directly maps the pageSetup element in the namespace
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Page setup
// settings for the worksheet.
type xlsxPageSetUp struct {
- BlackAndWhite bool `xml:"blackAndWhite,attr,omitempty"`
- CellComments string `xml:"cellComments,attr,omitempty"`
- Copies int `xml:"copies,attr,omitempty"`
- Draft bool `xml:"draft,attr,omitempty"`
- Errors string `xml:"errors,attr,omitempty"`
- FirstPageNumber int `xml:"firstPageNumber,attr,omitempty"`
- FitToHeight *int `xml:"fitToHeight,attr"`
- FitToWidth int `xml:"fitToWidth,attr,omitempty"`
- HorizontalDPI float32 `xml:"horizontalDpi,attr,omitempty"`
- RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
- Orientation string `xml:"orientation,attr,omitempty"`
- PageOrder string `xml:"pageOrder,attr,omitempty"`
- PaperHeight string `xml:"paperHeight,attr,omitempty"`
- PaperSize int `xml:"paperSize,attr,omitempty"`
- PaperWidth string `xml:"paperWidth,attr,omitempty"`
- Scale int `xml:"scale,attr,omitempty"`
- UseFirstPageNumber bool `xml:"useFirstPageNumber,attr,omitempty"`
- UsePrinterDefaults bool `xml:"usePrinterDefaults,attr,omitempty"`
- VerticalDPI float32 `xml:"verticalDpi,attr,omitempty"`
+ XMLName xml.Name `xml:"pageSetup"`
+ BlackAndWhite bool `xml:"blackAndWhite,attr,omitempty"`
+ CellComments string `xml:"cellComments,attr,omitempty"`
+ Copies int `xml:"copies,attr,omitempty"`
+ Draft bool `xml:"draft,attr,omitempty"`
+ Errors string `xml:"errors,attr,omitempty"`
+ FirstPageNumber int `xml:"firstPageNumber,attr,omitempty"`
+ FitToHeight int `xml:"fitToHeight,attr,omitempty"`
+ FitToWidth int `xml:"fitToWidth,attr,omitempty"`
+ HorizontalDPI int `xml:"horizontalDpi,attr,omitempty"`
+ RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
+ Orientation string `xml:"orientation,attr,omitempty"`
+ PageOrder string `xml:"pageOrder,attr,omitempty"`
+ PaperHeight string `xml:"paperHeight,attr,omitempty"`
+ PaperSize int `xml:"paperSize,attr,omitempty"`
+ PaperWidth string `xml:"paperWidth,attr,omitempty"`
+ Scale int `xml:"scale,attr,omitempty"`
+ UseFirstPageNumber bool `xml:"useFirstPageNumber,attr,omitempty"`
+ UsePrinterDefaults bool `xml:"usePrinterDefaults,attr,omitempty"`
+ VerticalDPI int `xml:"verticalDpi,attr,omitempty"`
}
// xlsxPrintOptions directly maps the printOptions element in the namespace
@@ -103,44 +126,48 @@ type xlsxPageSetUp struct {
// the sheet. Printer-specific settings are stored separately in the Printer
// Settings part.
type xlsxPrintOptions struct {
- GridLines bool `xml:"gridLines,attr,omitempty"`
- GridLinesSet bool `xml:"gridLinesSet,attr,omitempty"`
- Headings bool `xml:"headings,attr,omitempty"`
- HorizontalCentered bool `xml:"horizontalCentered,attr,omitempty"`
- VerticalCentered bool `xml:"verticalCentered,attr,omitempty"`
+ XMLName xml.Name `xml:"printOptions"`
+ GridLines bool `xml:"gridLines,attr,omitempty"`
+ GridLinesSet bool `xml:"gridLinesSet,attr,omitempty"`
+ Headings bool `xml:"headings,attr,omitempty"`
+ HorizontalCentered bool `xml:"horizontalCentered,attr,omitempty"`
+ VerticalCentered bool `xml:"verticalCentered,attr,omitempty"`
}
// xlsxPageMargins directly maps the pageMargins element in the namespace
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Page margins for
// a sheet or a custom sheet view.
type xlsxPageMargins struct {
- Bottom float64 `xml:"bottom,attr"`
- Footer float64 `xml:"footer,attr"`
- Header float64 `xml:"header,attr"`
- Left float64 `xml:"left,attr"`
- Right float64 `xml:"right,attr"`
- Top float64 `xml:"top,attr"`
+ XMLName xml.Name `xml:"pageMargins"`
+ Bottom float64 `xml:"bottom,attr"`
+ Footer float64 `xml:"footer,attr"`
+ Header float64 `xml:"header,attr"`
+ Left float64 `xml:"left,attr"`
+ Right float64 `xml:"right,attr"`
+ Top float64 `xml:"top,attr"`
}
// xlsxSheetFormatPr directly maps the sheetFormatPr element in the namespace
// http://schemas.openxmlformats.org/spreadsheetml/2006/main. This element
// specifies the sheet formatting properties.
type xlsxSheetFormatPr struct {
- BaseColWidth uint8 `xml:"baseColWidth,attr,omitempty"`
- DefaultColWidth float64 `xml:"defaultColWidth,attr,omitempty"`
- DefaultRowHeight float64 `xml:"defaultRowHeight,attr"`
- CustomHeight bool `xml:"customHeight,attr,omitempty"`
- ZeroHeight bool `xml:"zeroHeight,attr,omitempty"`
- ThickTop bool `xml:"thickTop,attr,omitempty"`
- ThickBottom bool `xml:"thickBottom,attr,omitempty"`
- OutlineLevelRow uint8 `xml:"outlineLevelRow,attr,omitempty"`
- OutlineLevelCol uint8 `xml:"outlineLevelCol,attr,omitempty"`
+ XMLName xml.Name `xml:"sheetFormatPr"`
+ BaseColWidth uint8 `xml:"baseColWidth,attr,omitempty"`
+ DefaultColWidth float64 `xml:"defaultColWidth,attr,omitempty"`
+ DefaultRowHeight float64 `xml:"defaultRowHeight,attr"`
+ CustomHeight bool `xml:"customHeight,attr,omitempty"`
+ ZeroHeight bool `xml:"zeroHeight,attr,omitempty"`
+ ThickTop bool `xml:"thickTop,attr,omitempty"`
+ ThickBottom bool `xml:"thickBottom,attr,omitempty"`
+ OutlineLevelRow uint8 `xml:"outlineLevelRow,attr,omitempty"`
+ OutlineLevelCol uint8 `xml:"outlineLevelCol,attr,omitempty"`
}
// xlsxSheetViews directly maps the sheetViews element in the namespace
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Worksheet views
// collection.
type xlsxSheetViews struct {
+ XMLName xml.Name `xml:"sheetViews"`
SheetView []xlsxSheetView `xml:"sheetView"`
}
@@ -154,13 +181,13 @@ type xlsxSheetViews struct {
// last sheetView definition is loaded, and the others are discarded. When
// multiple windows are viewing the same sheet, multiple sheetView elements
// (with corresponding workbookView entries) are saved.
-// See https://msdn.microsoft.com/en-us/library/office/documentformat.openxml.spreadsheet.sheetview.aspx
+// See https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.spreadsheet.sheetview
type xlsxSheetView struct {
WindowProtection bool `xml:"windowProtection,attr,omitempty"`
ShowFormulas bool `xml:"showFormulas,attr,omitempty"`
ShowGridLines *bool `xml:"showGridLines,attr"`
ShowRowColHeaders *bool `xml:"showRowColHeaders,attr"`
- ShowZeros bool `xml:"showZeros,attr,omitempty"`
+ ShowZeros *bool `xml:"showZeros,attr,omitempty"`
RightToLeft bool `xml:"rightToLeft,attr,omitempty"`
TabSelected bool `xml:"tabSelected,attr,omitempty"`
ShowWhiteSpace *bool `xml:"showWhiteSpace,attr"`
@@ -202,16 +229,18 @@ type xlsxPane struct {
// properties.
type xlsxSheetPr struct {
XMLName xml.Name `xml:"sheetPr"`
- CodeName string `xml:"codeName,attr,omitempty"`
- EnableFormatConditionsCalculation *bool `xml:"enableFormatConditionsCalculation,attr"`
- FilterMode bool `xml:"filterMode,attr,omitempty"`
- Published *bool `xml:"published,attr"`
SyncHorizontal bool `xml:"syncHorizontal,attr,omitempty"`
SyncVertical bool `xml:"syncVertical,attr,omitempty"`
+ SyncRef string `xml:"syncRef,attr,omitempty"`
+ TransitionEvaluation bool `xml:"transitionEvaluation,attr,omitempty"`
+ Published *bool `xml:"published,attr"`
+ CodeName string `xml:"codeName,attr,omitempty"`
+ FilterMode bool `xml:"filterMode,attr,omitempty"`
+ EnableFormatConditionsCalculation *bool `xml:"enableFormatConditionsCalculation,attr"`
TransitionEntry bool `xml:"transitionEntry,attr,omitempty"`
TabColor *xlsxTabColor `xml:"tabColor,omitempty"`
- PageSetUpPr *xlsxPageSetUpPr `xml:"pageSetUpPr,omitempty"`
OutlinePr *xlsxOutlinePr `xml:"outlinePr,omitempty"`
+ PageSetUpPr *xlsxPageSetUpPr `xml:"pageSetUpPr,omitempty"`
}
// xlsxOutlinePr maps to the outlinePr element
@@ -231,6 +260,7 @@ type xlsxPageSetUpPr struct {
// xlsxTabColor directly maps the tabColor element in the namespace currently I
// have not checked it for completeness - it does as much as I need.
type xlsxTabColor struct {
+ RGB string `xml:"rgb,attr,omitempty"`
Theme int `xml:"theme,attr,omitempty"`
Tint float64 `xml:"tint,attr,omitempty"`
}
@@ -239,22 +269,23 @@ type xlsxTabColor struct {
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have
// not checked it for completeness - it does as much as I need.
type xlsxCols struct {
- Col []xlsxCol `xml:"col"`
+ XMLName xml.Name `xml:"cols"`
+ Col []xlsxCol `xml:"col"`
}
// xlsxCol directly maps the col (Column Width & Formatting). Defines column
// width and column formatting for one or more columns of the worksheet.
type xlsxCol struct {
BestFit bool `xml:"bestFit,attr,omitempty"`
- Collapsed bool `xml:"collapsed,attr"`
+ Collapsed bool `xml:"collapsed,attr,omitempty"`
CustomWidth bool `xml:"customWidth,attr,omitempty"`
- Hidden bool `xml:"hidden,attr"`
+ Hidden bool `xml:"hidden,attr,omitempty"`
Max int `xml:"max,attr"`
Min int `xml:"min,attr"`
OutlineLevel uint8 `xml:"outlineLevel,attr,omitempty"`
Phonetic bool `xml:"phonetic,attr,omitempty"`
- Style int `xml:"style,attr"`
- Width float64 `xml:"width,attr"`
+ Style int `xml:"style,attr,omitempty"`
+ Width float64 `xml:"width,attr,omitempty"`
}
// xlsxDimension directly maps the dimension element in the namespace
@@ -265,7 +296,8 @@ type xlsxCol struct {
// When an entire column is formatted, only the first cell in that column is
// considered used.
type xlsxDimension struct {
- Ref string `xml:"ref,attr"`
+ XMLName xml.Name `xml:"dimension"`
+ Ref string `xml:"ref,attr"`
}
// xlsxSheetData directly maps the sheetData element in the namespace
@@ -295,6 +327,74 @@ type xlsxRow struct {
C []xlsxC `xml:"c"`
}
+// xlsxSortState directly maps the sortState element. This collection
+// preserves the AutoFilter sort state.
+type xlsxSortState struct {
+ ColumnSort bool `xml:"columnSort,attr,omitempty"`
+ CaseSensitive bool `xml:"caseSensitive,attr,omitempty"`
+ SortMethod string `xml:"sortMethod,attr,omitempty"`
+ Ref string `xml:"ref,attr"`
+ Content string `xml:",innerxml"`
+}
+
+// xlsxCustomSheetViews directly maps the customSheetViews element. This is a
+// collection of custom sheet views.
+type xlsxCustomSheetViews struct {
+ XMLName xml.Name `xml:"customSheetViews"`
+ CustomSheetView []*xlsxCustomSheetView `xml:"customSheetView"`
+}
+
+// xlsxBrk directly maps the row or column break to use when paginating a
+// worksheet.
+type xlsxBrk struct {
+ ID int `xml:"id,attr,omitempty"`
+ Min int `xml:"min,attr,omitempty"`
+ Max int `xml:"max,attr,omitempty"`
+ Man bool `xml:"man,attr,omitempty"`
+ Pt bool `xml:"pt,attr,omitempty"`
+}
+
+// xlsxBreaks directly maps a collection of the row or column breaks.
+type xlsxBreaks struct {
+ Brk []*xlsxBrk `xml:"brk"`
+ Count int `xml:"count,attr,omitempty"`
+ ManualBreakCount int `xml:"manualBreakCount,attr,omitempty"`
+}
+
+// xlsxCustomSheetView directly maps the customSheetView element.
+type xlsxCustomSheetView struct {
+ Pane *xlsxPane `xml:"pane"`
+ Selection *xlsxSelection `xml:"selection"`
+ RowBreaks *xlsxBreaks `xml:"rowBreaks"`
+ ColBreaks *xlsxBreaks `xml:"colBreaks"`
+ PageMargins *xlsxPageMargins `xml:"pageMargins"`
+ PrintOptions *xlsxPrintOptions `xml:"printOptions"`
+ PageSetup *xlsxPageSetUp `xml:"pageSetup"`
+ HeaderFooter *xlsxHeaderFooter `xml:"headerFooter"`
+ AutoFilter *xlsxAutoFilter `xml:"autoFilter"`
+ ExtLst *xlsxExtLst `xml:"extLst"`
+ GUID string `xml:"guid,attr"`
+ Scale int `xml:"scale,attr,omitempty"`
+ ColorID int `xml:"colorId,attr,omitempty"`
+ ShowPageBreaks bool `xml:"showPageBreaks,attr,omitempty"`
+ ShowFormulas bool `xml:"showFormulas,attr,omitempty"`
+ ShowGridLines bool `xml:"showGridLines,attr,omitempty"`
+ ShowRowCol bool `xml:"showRowCol,attr,omitempty"`
+ OutlineSymbols bool `xml:"outlineSymbols,attr,omitempty"`
+ ZeroValues bool `xml:"zeroValues,attr,omitempty"`
+ FitToPage bool `xml:"fitToPage,attr,omitempty"`
+ PrintArea bool `xml:"printArea,attr,omitempty"`
+ Filter bool `xml:"filter,attr,omitempty"`
+ ShowAutoFilter bool `xml:"showAutoFilter,attr,omitempty"`
+ HiddenRows bool `xml:"hiddenRows,attr,omitempty"`
+ HiddenColumns bool `xml:"hiddenColumns,attr,omitempty"`
+ State string `xml:"state,attr,omitempty"`
+ FilterUnique bool `xml:"filterUnique,attr,omitempty"`
+ View string `xml:"view,attr,omitempty"`
+ ShowRuler bool `xml:"showRuler,attr,omitempty"`
+ TopLeftCell string `xml:"topLeftCell,attr,omitempty"`
+}
+
// xlsxMergeCell directly maps the mergeCell element. A single merged cell.
type xlsxMergeCell struct {
Ref string `xml:"ref,attr,omitempty"`
@@ -303,13 +403,15 @@ type xlsxMergeCell struct {
// xlsxMergeCells directly maps the mergeCells element. This collection
// expresses all the merged cells in the sheet.
type xlsxMergeCells struct {
- Count int `xml:"count,attr,omitempty"`
- Cells []*xlsxMergeCell `xml:"mergeCell,omitempty"`
+ XMLName xml.Name `xml:"mergeCells"`
+ Count int `xml:"count,attr,omitempty"`
+ Cells []*xlsxMergeCell `xml:"mergeCell,omitempty"`
}
// xlsxDataValidations expresses all data validation information for cells in a
// sheet which have data validation features applied.
type xlsxDataValidations struct {
+ XMLName xml.Name `xml:"dataValidations"`
Count int `xml:"count,attr,omitempty"`
DisablePrompts bool `xml:"disablePrompts,attr,omitempty"`
XWindow int `xml:"xWindow,attr,omitempty"`
@@ -324,16 +426,16 @@ type DataValidation struct {
Error *string `xml:"error,attr"`
ErrorStyle *string `xml:"errorStyle,attr"`
ErrorTitle *string `xml:"errorTitle,attr"`
- Operator string `xml:"operator,attr"`
+ Operator string `xml:"operator,attr,omitempty"`
Prompt *string `xml:"prompt,attr"`
- PromptTitle *string `xml:"promptTitle"`
- ShowDropDown bool `xml:"showDropDown,attr"`
- ShowErrorMessage bool `xml:"showErrorMessage,attr"`
- ShowInputMessage bool `xml:"showInputMessage,attr"`
+ PromptTitle *string `xml:"promptTitle,attr"`
+ ShowDropDown bool `xml:"showDropDown,attr,omitempty"`
+ ShowErrorMessage bool `xml:"showErrorMessage,attr,omitempty"`
+ ShowInputMessage bool `xml:"showInputMessage,attr,omitempty"`
Sqref string `xml:"sqref,attr"`
- Type string `xml:"type,attr"`
- Formula1 string `xml:"formula1"`
- Formula2 string `xml:"formula2"`
+ Type string `xml:"type,attr,omitempty"`
+ Formula1 string `xml:",innerxml"`
+ Formula2 string `xml:",innerxml"`
}
// xlsxC directly maps the c element in the namespace
@@ -353,22 +455,19 @@ type DataValidation struct {
// str (String) | Cell containing a formula string.
//
type xlsxC struct {
- R string `xml:"r,attr"` // Cell ID, e.g. A1
- S int `xml:"s,attr,omitempty"` // Style reference.
- // Str string `xml:"str,attr,omitempty"` // Style reference.
- T string `xml:"t,attr,omitempty"` // Type.
- F *xlsxF `xml:"f,omitempty"` // Formula
- V string `xml:"v,omitempty"` // Value
- IS *xlsxIS `xml:"is"`
+ XMLName xml.Name `xml:"c"`
XMLSpace xml.Attr `xml:"space,attr,omitempty"`
+ R string `xml:"r,attr,omitempty"` // Cell ID, e.g. A1
+ S int `xml:"s,attr,omitempty"` // Style reference.
+ // Str string `xml:"str,attr,omitempty"` // Style reference.
+ T string `xml:"t,attr,omitempty"` // Type.
+ F *xlsxF `xml:"f,omitempty"` // Formula
+ V string `xml:"v,omitempty"` // Value
+ IS *xlsxSI `xml:"is"`
}
-// xlsxIS directly maps the t element. Cell containing an (inline) rich
-// string, i.e., one not in the shared string table. If this cell type is
-// used, then the cell value is in the is element rather than the v element in
-// the cell (c element).
-type xlsxIS struct {
- T string `xml:"t"`
+func (c *xlsxC) hasValue() bool {
+ return c.S != 0 || c.V != "" || c.F != nil || c.T != ""
}
// xlsxF directly maps the f element in the namespace
@@ -384,27 +483,28 @@ 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 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"`
+ XMLName xml.Name `xml:"sheetProtection"`
+ AlgorithmName string `xml:"algorithmName,attr,omitempty"`
+ Password string `xml:"password,attr,omitempty"`
+ HashValue string `xml:"hashValue,attr,omitempty"`
+ SaltValue string `xml:"saltValue,attr,omitempty"`
+ SpinCount int `xml:"spinCount,attr,omitempty"`
+ Sheet bool `xml:"sheet,attr"`
+ Objects bool `xml:"objects,attr"`
+ Scenarios bool `xml:"scenarios,attr"`
+ FormatCells bool `xml:"formatCells,attr"`
+ FormatColumns bool `xml:"formatColumns,attr"`
+ FormatRows bool `xml:"formatRows,attr"`
+ InsertColumns bool `xml:"insertColumns,attr"`
+ InsertRows bool `xml:"insertRows,attr"`
+ InsertHyperlinks bool `xml:"insertHyperlinks,attr"`
+ DeleteColumns bool `xml:"deleteColumns,attr"`
+ DeleteRows bool `xml:"deleteRows,attr"`
+ SelectLockedCells bool `xml:"selectLockedCells,attr"`
+ Sort bool `xml:"sort,attr"`
+ AutoFilter bool `xml:"autoFilter,attr"`
+ PivotTables bool `xml:"pivotTables,attr"`
+ SelectUnlockedCells bool `xml:"selectUnlockedCells,attr"`
}
// xlsxPhoneticPr (Phonetic Properties) represents a collection of phonetic
@@ -415,9 +515,10 @@ type xlsxSheetProtection struct {
// every phonetic hint is expressed as a phonetic run (rPh), and these
// properties specify how to display that phonetic run.
type xlsxPhoneticPr struct {
- Alignment string `xml:"alignment,attr,omitempty"`
- FontID *int `xml:"fontId,attr"`
- Type string `xml:"type,attr,omitempty"`
+ XMLName xml.Name `xml:"phoneticPr"`
+ Alignment string `xml:"alignment,attr,omitempty"`
+ FontID *int `xml:"fontId,attr"`
+ Type string `xml:"type,attr,omitempty"`
}
// A Conditional Format is a format, such as cell shading or font color, that a
@@ -425,8 +526,9 @@ type xlsxPhoneticPr struct {
// condition is true. This collection expresses conditional formatting rules
// applied to a particular cell or range.
type xlsxConditionalFormatting struct {
- SQRef string `xml:"sqref,attr,omitempty"`
- CfRule []*xlsxCfRule `xml:"cfRule"`
+ XMLName xml.Name `xml:"conditionalFormatting"`
+ SQRef string `xml:"sqref,attr,omitempty"`
+ CfRule []*xlsxCfRule `xml:"cfRule"`
}
// xlsxCfRule (Conditional Formatting Rule) represents a description of a
@@ -482,7 +584,7 @@ type xlsxIconSet struct {
type xlsxCfvo struct {
Gte bool `xml:"gte,attr,omitempty"`
Type string `xml:"type,attr,omitempty"`
- Val string `xml:"val,attr"`
+ Val string `xml:"val,attr,omitempty"`
ExtLst *xlsxExtLst `xml:"extLst"`
}
@@ -491,6 +593,7 @@ type xlsxCfvo struct {
// be stored in a package as a relationship. Hyperlinks shall be identified by
// containing a target which specifies the destination of the given hyperlink.
type xlsxHyperlinks struct {
+ XMLName xml.Name `xml:"hyperlinks"`
Hyperlink []xlsxHyperlink `xml:"hyperlink"`
}
@@ -535,6 +638,7 @@ type xlsxHyperlink struct {
// </worksheet>
//
type xlsxTableParts struct {
+ XMLName xml.Name `xml:"tableParts"`
Count int `xml:"count,attr,omitempty"`
TableParts []*xlsxTablePart `xml:"tablePart"`
}
@@ -552,7 +656,8 @@ type xlsxTablePart struct {
// <picture r:id="rId1"/>
//
type xlsxPicture struct {
- RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
+ XMLName xml.Name `xml:"picture"`
+ RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
}
// xlsxLegacyDrawing directly maps the legacyDrawing element in the namespace
@@ -565,7 +670,121 @@ type xlsxPicture struct {
// can also be used to explain assumptions made in a formula or to call out
// something special about the cell.
type xlsxLegacyDrawing struct {
- RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
+ XMLName xml.Name `xml:"legacyDrawing"`
+ RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
+}
+
+// xlsxLegacyDrawingHF specifies the explicit relationship to the part
+// containing the VML defining pictures rendered in the header / footer of the
+// sheet.
+type xlsxLegacyDrawingHF struct {
+ XMLName xml.Name `xml:"legacyDrawingHF"`
+ RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
+}
+
+type xlsxInnerXML struct {
+ Content string `xml:",innerxml"`
+}
+
+// xlsxWorksheetExt directly maps the ext element in the worksheet.
+type xlsxWorksheetExt struct {
+ XMLName xml.Name `xml:"ext"`
+ URI string `xml:"uri,attr"`
+ Content string `xml:",innerxml"`
+}
+
+// decodeWorksheetExt directly maps the ext element.
+type decodeWorksheetExt struct {
+ XMLName xml.Name `xml:"extLst"`
+ Ext []*xlsxWorksheetExt `xml:"ext"`
+}
+
+// decodeX14SparklineGroups directly maps the sparklineGroups element.
+type decodeX14SparklineGroups struct {
+ XMLName xml.Name `xml:"sparklineGroups"`
+ XMLNSXM string `xml:"xmlns:xm,attr"`
+ Content string `xml:",innerxml"`
+}
+
+// xlsxX14SparklineGroups directly maps the sparklineGroups element.
+type xlsxX14SparklineGroups struct {
+ XMLName xml.Name `xml:"x14:sparklineGroups"`
+ XMLNSXM string `xml:"xmlns:xm,attr"`
+ SparklineGroups []*xlsxX14SparklineGroup `xml:"x14:sparklineGroup"`
+ Content string `xml:",innerxml"`
+}
+
+// xlsxX14SparklineGroup directly maps the sparklineGroup element.
+type xlsxX14SparklineGroup struct {
+ XMLName xml.Name `xml:"x14:sparklineGroup"`
+ ManualMax int `xml:"manualMax,attr,omitempty"`
+ ManualMin int `xml:"manualMin,attr,omitempty"`
+ LineWeight float64 `xml:"lineWeight,attr,omitempty"`
+ Type string `xml:"type,attr,omitempty"`
+ DateAxis bool `xml:"dateAxis,attr,omitempty"`
+ DisplayEmptyCellsAs string `xml:"displayEmptyCellsAs,attr,omitempty"`
+ Markers bool `xml:"markers,attr,omitempty"`
+ High bool `xml:"high,attr,omitempty"`
+ Low bool `xml:"low,attr,omitempty"`
+ First bool `xml:"first,attr,omitempty"`
+ Last bool `xml:"last,attr,omitempty"`
+ Negative bool `xml:"negative,attr,omitempty"`
+ DisplayXAxis bool `xml:"displayXAxis,attr,omitempty"`
+ DisplayHidden bool `xml:"displayHidden,attr,omitempty"`
+ MinAxisType string `xml:"minAxisType,attr,omitempty"`
+ MaxAxisType string `xml:"maxAxisType,attr,omitempty"`
+ RightToLeft bool `xml:"rightToLeft,attr,omitempty"`
+ ColorSeries *xlsxTabColor `xml:"x14:colorSeries"`
+ ColorNegative *xlsxTabColor `xml:"x14:colorNegative"`
+ ColorAxis *xlsxColor `xml:"x14:colorAxis"`
+ ColorMarkers *xlsxTabColor `xml:"x14:colorMarkers"`
+ ColorFirst *xlsxTabColor `xml:"x14:colorFirst"`
+ ColorLast *xlsxTabColor `xml:"x14:colorLast"`
+ ColorHigh *xlsxTabColor `xml:"x14:colorHigh"`
+ ColorLow *xlsxTabColor `xml:"x14:colorLow"`
+ Sparklines xlsxX14Sparklines `xml:"x14:sparklines"`
+}
+
+// xlsxX14Sparklines directly maps the sparklines element.
+type xlsxX14Sparklines struct {
+ Sparkline []*xlsxX14Sparkline `xml:"x14:sparkline"`
+}
+
+// xlsxX14Sparkline directly maps the sparkline element.
+type xlsxX14Sparkline struct {
+ F string `xml:"xm:f"`
+ Sqref string `xml:"xm:sqref"`
+}
+
+// SparklineOption directly maps the settings of the sparkline.
+type SparklineOption struct {
+ Location []string
+ Range []string
+ Max int
+ CustMax int
+ Min int
+ CustMin int
+ Type string
+ Weight float64
+ DateAxis bool
+ Markers bool
+ High bool
+ Low bool
+ First bool
+ Last bool
+ Negative bool
+ Axis bool
+ Hidden bool
+ Reverse bool
+ Style int
+ SeriesColor string
+ NegativeColor string
+ MarkersColor string
+ FirstColor string
+ LastColor string
+ HightColor string
+ LowColor string
+ EmptyCells string
}
// formatPanes directly maps the settings of the panes.
@@ -627,3 +846,27 @@ type FormatSheetProtection struct {
SelectUnlockedCells bool
Sort bool
}
+
+// FormatHeaderFooter directly maps the settings of header and footer.
+type FormatHeaderFooter struct {
+ AlignWithMargins bool
+ DifferentFirst bool
+ DifferentOddEven bool
+ ScaleWithDoc bool
+ OddHeader string
+ OddFooter string
+ EvenHeader string
+ EvenFooter string
+ FirstFooter string
+ FirstHeader string
+}
+
+// FormatPageMargins directly maps the settings of page margins
+type FormatPageMargins struct {
+ Bottom string
+ Footer string
+ Header string
+ Left string
+ Right string
+ Top string
+}