xmlWorksheet.go 39.7 KB
Newer Older
xurime's avatar
xurime 已提交
1
// Copyright 2016 - 2020 The excelize Authors. All rights reserved. Use of
xurime's avatar
xurime 已提交
2 3 4 5
// 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
xurime's avatar
xurime 已提交
6 7 8 9 10
// and read from XLSX / XLSM / XLTM files. Supports reading and writing
// spreadsheet documents generated by Microsoft Exce™ 2007 and later. Supports
// complex components by high compatibility, and provided streaming API for
// generating or reading data from a worksheet with huge amounts of data. This
// library needs Go version 1.10 or later.
xurime's avatar
xurime 已提交
11

xurime's avatar
xurime 已提交
12 13
package excelize

14 15 16 17
import (
	"encoding/xml"
	"sync"
)
xurime's avatar
xurime 已提交
18 19

// xlsxWorksheet directly maps the worksheet element in the namespace
20
// http://schemas.openxmlformats.org/spreadsheetml/2006/main.
xurime's avatar
xurime 已提交
21
type xlsxWorksheet struct {
xurime's avatar
xurime 已提交
22
	sync.Mutex
23 24
	XMLName               xml.Name                     `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main worksheet"`
	SheetPr               *xlsxSheetPr                 `xml:"sheetPr"`
xurime's avatar
xurime 已提交
25
	Dimension             *xlsxDimension               `xml:"dimension"`
26
	SheetViews            *xlsxSheetViews              `xml:"sheetViews"`
27
	SheetFormatPr         *xlsxSheetFormatPr           `xml:"sheetFormatPr"`
xurime's avatar
xurime 已提交
28
	Cols                  *xlsxCols                    `xml:"cols"`
29
	SheetData             xlsxSheetData                `xml:"sheetData"`
30
	SheetCalcPr           *xlsxInnerXML                `xml:"sheetCalcPr"`
31
	SheetProtection       *xlsxSheetProtection         `xml:"sheetProtection"`
32 33
	ProtectedRanges       *xlsxInnerXML                `xml:"protectedRanges"`
	Scenarios             *xlsxInnerXML                `xml:"scenarios"`
34
	AutoFilter            *xlsxAutoFilter              `xml:"autoFilter"`
35
	SortState             *xlsxSortState               `xml:"sortState"`
36
	DataConsolidate       *xlsxInnerXML                `xml:"dataConsolidate"`
37
	CustomSheetViews      *xlsxCustomSheetViews        `xml:"customSheetViews"`
38 39
	MergeCells            *xlsxMergeCells              `xml:"mergeCells"`
	PhoneticPr            *xlsxPhoneticPr              `xml:"phoneticPr"`
40
	ConditionalFormatting []*xlsxConditionalFormatting `xml:"conditionalFormatting"`
xurime's avatar
xurime 已提交
41
	DataValidations       *xlsxDataValidations         `xml:"dataValidations"`
42 43 44 45 46
	Hyperlinks            *xlsxHyperlinks              `xml:"hyperlinks"`
	PrintOptions          *xlsxPrintOptions            `xml:"printOptions"`
	PageMargins           *xlsxPageMargins             `xml:"pageMargins"`
	PageSetUp             *xlsxPageSetUp               `xml:"pageSetup"`
	HeaderFooter          *xlsxHeaderFooter            `xml:"headerFooter"`
47 48
	RowBreaks             *xlsxBreaks                  `xml:"rowBreaks"`
	ColBreaks             *xlsxBreaks                  `xml:"colBreaks"`
49 50 51 52
	CustomProperties      *xlsxInnerXML                `xml:"customProperties"`
	CellWatches           *xlsxInnerXML                `xml:"cellWatches"`
	IgnoredErrors         *xlsxInnerXML                `xml:"ignoredErrors"`
	SmartTags             *xlsxInnerXML                `xml:"smartTags"`
53 54
	Drawing               *xlsxDrawing                 `xml:"drawing"`
	LegacyDrawing         *xlsxLegacyDrawing           `xml:"legacyDrawing"`
55
	LegacyDrawingHF       *xlsxLegacyDrawingHF         `xml:"legacyDrawingHF"`
56
	DrawingHF             *xlsxDrawingHF               `xml:"drawingHF"`
57
	Picture               *xlsxPicture                 `xml:"picture"`
58 59 60
	OleObjects            *xlsxInnerXML                `xml:"oleObjects"`
	Controls              *xlsxInnerXML                `xml:"controls"`
	WebPublishItems       *xlsxInnerXML                `xml:"webPublishItems"`
61 62
	TableParts            *xlsxTableParts              `xml:"tableParts"`
	ExtLst                *xlsxExtLst                  `xml:"extLst"`
xurime's avatar
xurime 已提交
63 64
}

xurime's avatar
xurime 已提交
65
// xlsxDrawing change r:id to rid in the namespace.
xurime's avatar
xurime 已提交
66
type xlsxDrawing struct {
67 68
	XMLName xml.Name `xml:"drawing"`
	RID     string   `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
xurime's avatar
xurime 已提交
69 70 71
}

// xlsxHeaderFooter directly maps the headerFooter element in the namespace
72 73 74 75 76 77
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - When printed or
// viewed in page layout view (§18.18.69), each page of a worksheet can have a
// page header, a page footer, or both. The headers and footers on odd-numbered
// pages can differ from those on even-numbered pages, and the headers and
// 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.
xurime's avatar
xurime 已提交
78
type xlsxHeaderFooter struct {
79
	XMLName          xml.Name       `xml:"headerFooter"`
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
	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 {
101
	Content string `xml:",innerxml"`
xurime's avatar
xurime 已提交
102 103 104
}

// xlsxPageSetUp directly maps the pageSetup element in the namespace
105 106
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Page setup
// settings for the worksheet.
xurime's avatar
xurime 已提交
107
type xlsxPageSetUp struct {
108 109 110 111 112 113 114 115 116
	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"`
117
	HorizontalDPI      int      `xml:"horizontalDpi,attr,omitempty"`
118 119 120 121 122 123 124 125 126
	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"`
127
	VerticalDPI        int      `xml:"verticalDpi,attr,omitempty"`
xurime's avatar
xurime 已提交
128 129 130
}

// xlsxPrintOptions directly maps the printOptions element in the namespace
131 132 133
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Print options for
// the sheet. Printer-specific settings are stored separately in the Printer
// Settings part.
xurime's avatar
xurime 已提交
134
type xlsxPrintOptions struct {
135 136 137 138 139 140
	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"`
xurime's avatar
xurime 已提交
141 142 143
}

// xlsxPageMargins directly maps the pageMargins element in the namespace
144 145
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Page margins for
// a sheet or a custom sheet view.
xurime's avatar
xurime 已提交
146
type xlsxPageMargins struct {
147 148 149 150 151 152 153
	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"`
xurime's avatar
xurime 已提交
154 155 156
}

// xlsxSheetFormatPr directly maps the sheetFormatPr element in the namespace
157 158
// http://schemas.openxmlformats.org/spreadsheetml/2006/main. This element
// specifies the sheet formatting properties.
xurime's avatar
xurime 已提交
159
type xlsxSheetFormatPr struct {
160 161 162 163 164 165 166 167 168 169
	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"`
xurime's avatar
xurime 已提交
170 171
}

xurime's avatar
xurime 已提交
172
// xlsxSheetViews represents worksheet views collection.
xurime's avatar
xurime 已提交
173
type xlsxSheetViews struct {
174
	XMLName   xml.Name        `xml:"sheetViews"`
xurime's avatar
xurime 已提交
175 176 177
	SheetView []xlsxSheetView `xml:"sheetView"`
}

xurime's avatar
xurime 已提交
178 179 180 181 182 183 184 185
// xlsxSheetView represents a single sheet view definition. When more than one
// sheet view is defined in the file, it means that when opening the workbook,
// each sheet view corresponds to a separate window within the spreadsheet
// application, where each window is showing the particular sheet containing
// the same workbookViewId value, the 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.
xurime's avatar
xurime 已提交
186
type xlsxSheetView struct {
187 188
	WindowProtection         bool             `xml:"windowProtection,attr,omitempty"`
	ShowFormulas             bool             `xml:"showFormulas,attr,omitempty"`
189 190
	ShowGridLines            *bool            `xml:"showGridLines,attr"`
	ShowRowColHeaders        *bool            `xml:"showRowColHeaders,attr"`
191
	ShowZeros                *bool            `xml:"showZeros,attr,omitempty"`
192 193 194 195
	RightToLeft              bool             `xml:"rightToLeft,attr,omitempty"`
	TabSelected              bool             `xml:"tabSelected,attr,omitempty"`
	ShowWhiteSpace           *bool            `xml:"showWhiteSpace,attr"`
	ShowOutlineSymbols       bool             `xml:"showOutlineSymbols,attr,omitempty"`
196
	DefaultGridColor         *bool            `xml:"defaultGridColor,attr"`
197 198 199 200 201 202 203 204 205 206
	View                     string           `xml:"view,attr,omitempty"`
	TopLeftCell              string           `xml:"topLeftCell,attr,omitempty"`
	ColorID                  int              `xml:"colorId,attr,omitempty"`
	ZoomScale                float64          `xml:"zoomScale,attr,omitempty"`
	ZoomScaleNormal          float64          `xml:"zoomScaleNormal,attr,omitempty"`
	ZoomScalePageLayoutView  float64          `xml:"zoomScalePageLayoutView,attr,omitempty"`
	ZoomScaleSheetLayoutView float64          `xml:"zoomScaleSheetLayoutView,attr,omitempty"`
	WorkbookViewID           int              `xml:"workbookViewId,attr"`
	Pane                     *xlsxPane        `xml:"pane,omitempty"`
	Selection                []*xlsxSelection `xml:"selection"`
xurime's avatar
xurime 已提交
207 208 209
}

// xlsxSelection directly maps the selection element in the namespace
210 211
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Worksheet view
// selection.
xurime's avatar
xurime 已提交
212
type xlsxSelection struct {
213
	ActiveCell   string `xml:"activeCell,attr,omitempty"`
xurime's avatar
xurime 已提交
214
	ActiveCellID *int   `xml:"activeCellId,attr"`
215
	Pane         string `xml:"pane,attr,omitempty"`
216
	SQRef        string `xml:"sqref,attr,omitempty"`
xurime's avatar
xurime 已提交
217 218
}

219
// xlsxSelection directly maps the selection element. Worksheet view pane.
xurime's avatar
xurime 已提交
220 221 222
type xlsxPane struct {
	ActivePane  string  `xml:"activePane,attr,omitempty"`
	State       string  `xml:"state,attr,omitempty"` // Either "split" or "frozen"
223 224 225
	TopLeftCell string  `xml:"topLeftCell,attr,omitempty"`
	XSplit      float64 `xml:"xSplit,attr,omitempty"`
	YSplit      float64 `xml:"ySplit,attr,omitempty"`
xurime's avatar
xurime 已提交
226 227 228
}

// xlsxSheetPr directly maps the sheetPr element in the namespace
229 230
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Sheet-level
// properties.
xurime's avatar
xurime 已提交
231
type xlsxSheetPr struct {
232 233 234
	XMLName                           xml.Name         `xml:"sheetPr"`
	SyncHorizontal                    bool             `xml:"syncHorizontal,attr,omitempty"`
	SyncVertical                      bool             `xml:"syncVertical,attr,omitempty"`
235 236
	SyncRef                           string           `xml:"syncRef,attr,omitempty"`
	TransitionEvaluation              bool             `xml:"transitionEvaluation,attr,omitempty"`
237
	TransitionEntry                   bool             `xml:"transitionEntry,attr,omitempty"`
238 239 240 241
	Published                         *bool            `xml:"published,attr"`
	CodeName                          string           `xml:"codeName,attr,omitempty"`
	FilterMode                        bool             `xml:"filterMode,attr,omitempty"`
	EnableFormatConditionsCalculation *bool            `xml:"enableFormatConditionsCalculation,attr"`
242
	TabColor                          *xlsxTabColor    `xml:"tabColor,omitempty"`
H
Harris 已提交
243
	OutlinePr                         *xlsxOutlinePr   `xml:"outlinePr,omitempty"`
244
	PageSetUpPr                       *xlsxPageSetUpPr `xml:"pageSetUpPr,omitempty"`
H
Harris 已提交
245 246
}

xurime's avatar
xurime 已提交
247 248
// xlsxOutlinePr maps to the outlinePr element. SummaryBelow allows you to
// adjust the direction of grouper controls.
H
Harris 已提交
249
type xlsxOutlinePr struct {
250 251 252 253
	ApplyStyles        *bool `xml:"applyStyles,attr"`
	SummaryBelow       bool  `xml:"summaryBelow,attr,omitempty"`
	SummaryRight       bool  `xml:"summaryRight,attr,omitempty"`
	ShowOutlineSymbols bool  `xml:"showOutlineSymbols,attr,omitempty"`
xurime's avatar
xurime 已提交
254 255
}

xurime's avatar
xurime 已提交
256
// xlsxPageSetUpPr expresses page setup properties of the worksheet.
xurime's avatar
xurime 已提交
257
type xlsxPageSetUpPr struct {
258
	AutoPageBreaks bool `xml:"autoPageBreaks,attr,omitempty"`
xurime's avatar
xurime 已提交
259
	FitToPage      bool `xml:"fitToPage,attr,omitempty"`
260 261
}

xurime's avatar
xurime 已提交
262
// xlsxTabColor represents background color of the sheet tab.
263
type xlsxTabColor struct {
264 265 266 267 268
	Auto    bool    `xml:"auto,attr,omitempty"`
	Indexed int     `xml:"indexed,attr,omitempty"`
	RGB     string  `xml:"rgb,attr,omitempty"`
	Theme   int     `xml:"theme,attr,omitempty"`
	Tint    float64 `xml:"tint,attr,omitempty"`
xurime's avatar
xurime 已提交
269 270
}

xurime's avatar
xurime 已提交
271 272
// xlsxCols defines column width and column formatting for one or more columns
// of the worksheet.
xurime's avatar
xurime 已提交
273
type xlsxCols struct {
274 275
	XMLName xml.Name  `xml:"cols"`
	Col     []xlsxCol `xml:"col"`
xurime's avatar
xurime 已提交
276 277
}

278 279
// xlsxCol directly maps the col (Column Width & Formatting). Defines column
// width and column formatting for one or more columns of the worksheet.
xurime's avatar
xurime 已提交
280
type xlsxCol struct {
281
	BestFit      bool    `xml:"bestFit,attr,omitempty"`
282
	Collapsed    bool    `xml:"collapsed,attr,omitempty"`
283
	CustomWidth  bool    `xml:"customWidth,attr,omitempty"`
284
	Hidden       bool    `xml:"hidden,attr,omitempty"`
xurime's avatar
xurime 已提交
285 286
	Max          int     `xml:"max,attr"`
	Min          int     `xml:"min,attr"`
287 288
	OutlineLevel uint8   `xml:"outlineLevel,attr,omitempty"`
	Phonetic     bool    `xml:"phonetic,attr,omitempty"`
289 290
	Style        int     `xml:"style,attr,omitempty"`
	Width        float64 `xml:"width,attr,omitempty"`
xurime's avatar
xurime 已提交
291 292 293
}

// xlsxDimension directly maps the dimension element in the namespace
294 295
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - This element
// specifies the used range of the worksheet. It specifies the row and column
xurime's avatar
xurime 已提交
296 297 298 299
// bounds of used cells in the worksheet. This is optional and is not
// required. Used cells include cells with formulas, text content, and cell
// formatting. When an entire column is formatted, only the first cell in that
// column is considered used.
xurime's avatar
xurime 已提交
300
type xlsxDimension struct {
301 302
	XMLName xml.Name `xml:"dimension"`
	Ref     string   `xml:"ref,attr"`
xurime's avatar
xurime 已提交
303 304
}

xurime's avatar
xurime 已提交
305 306 307
// xlsxSheetData collection represents the cell table itself. This collection
// expresses information about each cell, grouped together by rows in the
// worksheet.
xurime's avatar
xurime 已提交
308 309 310 311 312
type xlsxSheetData struct {
	XMLName xml.Name  `xml:"sheetData"`
	Row     []xlsxRow `xml:"row"`
}

313
// xlsxRow directly maps the row element. The element expresses information
314 315
// about an entire row of a worksheet, and contains all cell definitions for a
// particular row in the worksheet.
xurime's avatar
xurime 已提交
316
type xlsxRow struct {
T
Ted 已提交
317 318 319 320
	C            []xlsxC `xml:"c"`
	R            int     `xml:"r,attr,omitempty"`
	Spans        string  `xml:"spans,attr,omitempty"`
	S            int     `xml:"s,attr,omitempty"`
321
	CustomFormat bool    `xml:"customFormat,attr,omitempty"`
322
	Ht           float64 `xml:"ht,attr,omitempty"`
T
Ted 已提交
323 324
	Hidden       bool    `xml:"hidden,attr,omitempty"`
	CustomHeight bool    `xml:"customHeight,attr,omitempty"`
xurime's avatar
xurime 已提交
325
	OutlineLevel uint8   `xml:"outlineLevel,attr,omitempty"`
T
Ted 已提交
326
	Collapsed    bool    `xml:"collapsed,attr,omitempty"`
327
	ThickTop     bool    `xml:"thickTop,attr,omitempty"`
T
Ted 已提交
328 329
	ThickBot     bool    `xml:"thickBot,attr,omitempty"`
	Ph           bool    `xml:"ph,attr,omitempty"`
xurime's avatar
xurime 已提交
330 331
}

332 333 334 335 336 337 338 339 340 341
// 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"`
}

342 343 344
// xlsxCustomSheetViews directly maps the customSheetViews element. This is a
// collection of custom sheet views.
type xlsxCustomSheetViews struct {
345
	XMLName         xml.Name               `xml:"customSheetViews"`
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360
	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 {
361 362 363
	Brk              []*xlsxBrk `xml:"brk"`
	Count            int        `xml:"count,attr,omitempty"`
	ManualBreakCount int        `xml:"manualBreakCount,attr,omitempty"`
364 365 366 367 368 369 370 371 372 373 374 375 376
}

// 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"`
xurime's avatar
xurime 已提交
377
	ExtLst         *xlsxExtLst       `xml:"extLst"`
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
	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"`
}

400
// xlsxMergeCell directly maps the mergeCell element. A single merged cell.
xurime's avatar
xurime 已提交
401
type xlsxMergeCell struct {
402
	Ref string `xml:"ref,attr,omitempty"`
xurime's avatar
xurime 已提交
403 404
}

405 406
// xlsxMergeCells directly maps the mergeCells element. This collection
// expresses all the merged cells in the sheet.
xurime's avatar
xurime 已提交
407
type xlsxMergeCells struct {
408 409 410
	XMLName xml.Name         `xml:"mergeCells"`
	Count   int              `xml:"count,attr,omitempty"`
	Cells   []*xlsxMergeCell `xml:"mergeCell,omitempty"`
xurime's avatar
xurime 已提交
411 412
}

413 414 415
// xlsxDataValidations expresses all data validation information for cells in a
// sheet which have data validation features applied.
type xlsxDataValidations struct {
416
	XMLName        xml.Name          `xml:"dataValidations"`
Reage--'s avatar
Reage-- 已提交
417 418 419 420
	Count          int               `xml:"count,attr,omitempty"`
	DisablePrompts bool              `xml:"disablePrompts,attr,omitempty"`
	XWindow        int               `xml:"xWindow,attr,omitempty"`
	YWindow        int               `xml:"yWindow,attr,omitempty"`
421
	DataValidation []*DataValidation `xml:"dataValidation"`
Reage--'s avatar
Reage-- 已提交
422 423
}

xurime's avatar
xurime 已提交
424 425
// DataValidation directly maps the a single item of data validation defined
// on a range of the worksheet.
Reage--'s avatar
Reage-- 已提交
426
type DataValidation struct {
xurime's avatar
xurime 已提交
427 428 429 430
	AllowBlank       bool    `xml:"allowBlank,attr"`
	Error            *string `xml:"error,attr"`
	ErrorStyle       *string `xml:"errorStyle,attr"`
	ErrorTitle       *string `xml:"errorTitle,attr"`
431
	Operator         string  `xml:"operator,attr,omitempty"`
Reage--'s avatar
Reage-- 已提交
432
	Prompt           *string `xml:"prompt,attr"`
433 434 435 436
	PromptTitle      *string `xml:"promptTitle,attr"`
	ShowDropDown     bool    `xml:"showDropDown,attr,omitempty"`
	ShowErrorMessage bool    `xml:"showErrorMessage,attr,omitempty"`
	ShowInputMessage bool    `xml:"showInputMessage,attr,omitempty"`
xurime's avatar
xurime 已提交
437
	Sqref            string  `xml:"sqref,attr"`
438
	Type             string  `xml:"type,attr,omitempty"`
439 440
	Formula1         string  `xml:",innerxml"`
	Formula2         string  `xml:",innerxml"`
441 442
}

xurime's avatar
xurime 已提交
443 444 445
// xlsxC collection represents a cell in the worksheet. Information about the
// cell's location (reference), value, data type, formatting, and formula is
// expressed here.
446 447 448 449 450 451 452 453 454 455 456 457 458
//
// This simple type is restricted to the values listed in the following table:
//
//      Enumeration Value         | Description
//     ---------------------------+---------------------------------
//      b (Boolean)               | Cell containing a boolean.
//      d (Date)                  | Cell contains a date in the ISO 8601 format.
//      e (Error)                 | Cell containing an error.
//      inlineStr (Inline String) | 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).
//      n (Number)                | Cell containing a number.
//      s (Shared String)         | Cell containing a shared string.
//      str (String)              | Cell containing a formula string.
//
xurime's avatar
xurime 已提交
459
type xlsxC struct {
460
	XMLName  xml.Name `xml:"c"`
461
	XMLSpace xml.Attr `xml:"space,attr,omitempty"`
462
	R        string   `xml:"r,attr,omitempty"` // Cell ID, e.g. A1
463 464 465 466 467 468
	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"`
xurime's avatar
xurime 已提交
469 470
}

H
Harris 已提交
471 472 473 474
func (c *xlsxC) hasValue() bool {
	return c.S != 0 || c.V != "" || c.F != nil || c.T != ""
}

xurime's avatar
xurime 已提交
475 476
// xlsxF represents a formula for the cell. The formula expression is
// contained in the character node of this element.
xurime's avatar
xurime 已提交
477
type xlsxF struct {
478
	Content string `xml:",chardata"`
xurime's avatar
xurime 已提交
479 480
	T       string `xml:"t,attr,omitempty"`   // Formula type
	Ref     string `xml:"ref,attr,omitempty"` // Shared formula ref
481
	Si      string `xml:"si,attr,omitempty"`  // Shared formula index
xurime's avatar
xurime 已提交
482
}
483

484 485
// xlsxSheetProtection collection expresses the sheet protection options to
// enforce when the sheet is protected.
486
type xlsxSheetProtection struct {
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508
	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"`
509 510
}

511 512 513 514 515 516 517 518
// xlsxPhoneticPr (Phonetic Properties) represents a collection of phonetic
// properties that affect the display of phonetic text for this String Item
// (si). Phonetic text is used to give hints as to the pronunciation of an East
// Asian language, and the hints are displayed as text within the spreadsheet
// cells across the top portion of the cell. Since the phonetic hints are text,
// every phonetic hint is expressed as a phonetic run (rPh), and these
// properties specify how to display that phonetic run.
type xlsxPhoneticPr struct {
519 520 521 522
	XMLName   xml.Name `xml:"phoneticPr"`
	Alignment string   `xml:"alignment,attr,omitempty"`
	FontID    *int     `xml:"fontId,attr"`
	Type      string   `xml:"type,attr,omitempty"`
523 524
}

525 526 527 528
// A Conditional Format is a format, such as cell shading or font color, that a
// spreadsheet application can automatically apply to cells if a specified
// condition is true. This collection expresses conditional formatting rules
// applied to a particular cell or range.
529
type xlsxConditionalFormatting struct {
530 531 532
	XMLName xml.Name      `xml:"conditionalFormatting"`
	SQRef   string        `xml:"sqref,attr,omitempty"`
	CfRule  []*xlsxCfRule `xml:"cfRule"`
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587
}

// xlsxCfRule (Conditional Formatting Rule) represents a description of a
// conditional formatting rule.
type xlsxCfRule struct {
	AboveAverage *bool           `xml:"aboveAverage,attr"`
	Bottom       bool            `xml:"bottom,attr,omitempty"`
	DxfID        *int            `xml:"dxfId,attr"`
	EqualAverage bool            `xml:"equalAverage,attr,omitempty"`
	Operator     string          `xml:"operator,attr,omitempty"`
	Percent      bool            `xml:"percent,attr,omitempty"`
	Priority     int             `xml:"priority,attr,omitempty"`
	Rank         int             `xml:"rank,attr,omitempty"`
	StdDev       int             `xml:"stdDev,attr,omitempty"`
	StopIfTrue   bool            `xml:"stopIfTrue,attr,omitempty"`
	Text         string          `xml:"text,attr,omitempty"`
	TimePeriod   string          `xml:"timePeriod,attr,omitempty"`
	Type         string          `xml:"type,attr,omitempty"`
	Formula      []string        `xml:"formula,omitempty"`
	ColorScale   *xlsxColorScale `xml:"colorScale"`
	DataBar      *xlsxDataBar    `xml:"dataBar"`
	IconSet      *xlsxIconSet    `xml:"iconSet"`
	ExtLst       *xlsxExtLst     `xml:"extLst"`
}

// xlsxColorScale (Color Scale) describes a gradated color scale in this
// conditional formatting rule.
type xlsxColorScale struct {
	Cfvo  []*xlsxCfvo  `xml:"cfvo"`
	Color []*xlsxColor `xml:"color"`
}

// dataBar (Data Bar) describes a data bar conditional formatting rule.
type xlsxDataBar struct {
	MaxLength int          `xml:"maxLength,attr,omitempty"`
	MinLength int          `xml:"minLength,attr,omitempty"`
	ShowValue bool         `xml:"showValue,attr,omitempty"`
	Cfvo      []*xlsxCfvo  `xml:"cfvo"`
	Color     []*xlsxColor `xml:"color"`
}

// xlsxIconSet (Icon Set) describes an icon set conditional formatting rule.
type xlsxIconSet struct {
	Cfvo      []*xlsxCfvo `xml:"cfvo"`
	IconSet   string      `xml:"iconSet,attr,omitempty"`
	ShowValue bool        `xml:"showValue,attr,omitempty"`
	Percent   bool        `xml:"percent,attr,omitempty"`
	Reverse   bool        `xml:"reverse,attr,omitempty"`
}

// cfvo (Conditional Format Value Object) describes the values of the
// interpolation points in a gradient scale.
type xlsxCfvo struct {
	Gte    bool        `xml:"gte,attr,omitempty"`
	Type   string      `xml:"type,attr,omitempty"`
588
	Val    string      `xml:"val,attr,omitempty"`
589
	ExtLst *xlsxExtLst `xml:"extLst"`
590 591
}

592
// xlsxHyperlinks directly maps the hyperlinks element in the namespace
593 594 595
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - A hyperlink can
// be stored in a package as a relationship. Hyperlinks shall be identified by
// containing a target which specifies the destination of the given hyperlink.
596
type xlsxHyperlinks struct {
597
	XMLName   xml.Name        `xml:"hyperlinks"`
598 599 600 601 602 603 604 605 606 607 608
	Hyperlink []xlsxHyperlink `xml:"hyperlink"`
}

// xlsxHyperlink directly maps the hyperlink element in the namespace
// http://schemas.openxmlformats.org/spreadsheetml/2006/main
type xlsxHyperlink struct {
	Ref      string `xml:"ref,attr"`
	Location string `xml:"location,attr,omitempty"`
	Display  string `xml:"display,attr,omitempty"`
	RID      string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
}
609 610

// xlsxTableParts directly maps the tableParts element in the namespace
611 612 613 614 615 616 617 618 619 620
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - The table element
// has several attributes applied to identify the table and the data range it
// covers. The table id attribute needs to be unique across all table parts, the
// same goes for the name and displayName. The displayName has the further
// restriction that it must be unique across all defined names in the workbook.
// Later on we will see that you can define names for many elements, such as
// cells or formulas. The name value is used for the object model in Microsoft
// Office Excel. The displayName is used for references in formulas. The ref
// attribute is used to identify the cell range that the table covers. This
// includes not only the table data, but also the table header containing column
621 622
// names.
// To add columns to your table you add new tableColumn elements to the
623 624 625 626 627 628 629 630 631 632
// tableColumns container. Similar to the shared string table the collection
// keeps a count attribute identifying the number of columns. Besides the table
// definition in the table part there is also the need to identify which tables
// are displayed in the worksheet. The worksheet part has a separate element
// tableParts to store this information. Each table part is referenced through
// the relationship ID and again a count of the number of table parts is
// maintained. The following markup sample is taken from the documents
// accompanying this book. The sheet data element has been removed to reduce the
// size of the sample. To reference the table, just add the tableParts element,
// of course after having created and stored the table part. For example:
633 634 635 636 637 638 639 640 641
//
//    <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
//        ...
//        <tableParts count="1">
// 		      <tablePart r:id="rId1" />
//        </tableParts>
//    </worksheet>
//
type xlsxTableParts struct {
642
	XMLName    xml.Name         `xml:"tableParts"`
643 644
	Count      int              `xml:"count,attr,omitempty"`
	TableParts []*xlsxTablePart `xml:"tablePart"`
645 646 647 648 649 650 651 652 653
}

// xlsxTablePart directly maps the tablePart element in the namespace
// http://schemas.openxmlformats.org/spreadsheetml/2006/main
type xlsxTablePart struct {
	RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
}

// xlsxPicture directly maps the picture element in the namespace
654 655
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Background sheet
// image. For example:
656 657 658 659
//
//    <picture r:id="rId1"/>
//
type xlsxPicture struct {
660 661
	XMLName xml.Name `xml:"picture"`
	RID     string   `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
662
}
xurime's avatar
xurime 已提交
663 664

// xlsxLegacyDrawing directly maps the legacyDrawing element in the namespace
665 666 667 668 669 670 671 672
// http://schemas.openxmlformats.org/spreadsheetml/2006/main - A comment is a
// rich text note that is attached to, and associated with, a cell, separate
// from other cell content. Comment content is stored separate from the cell,
// and is displayed in a drawing object (like a text box) that is separate from,
// but associated with, a cell. Comments are used as reminders, such as noting
// how a complex formula works, or to provide feedback to other users. Comments
// can also be used to explain assumptions made in a formula or to call out
// something special about the cell.
xurime's avatar
xurime 已提交
673
type xlsxLegacyDrawing struct {
674 675
	XMLName xml.Name `xml:"legacyDrawing"`
	RID     string   `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
xurime's avatar
xurime 已提交
676
}
xurime's avatar
xurime 已提交
677

678 679 680 681 682 683 684 685
// 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"`
}

686 687 688 689
type xlsxInnerXML struct {
	Content string `xml:",innerxml"`
}

xurime's avatar
xurime 已提交
690 691
// xlsxWorksheetExt directly maps the ext element in the worksheet.
type xlsxWorksheetExt struct {
xurime's avatar
xurime 已提交
692 693 694
	XMLName xml.Name `xml:"ext"`
	URI     string   `xml:"uri,attr"`
	Content string   `xml:",innerxml"`
xurime's avatar
xurime 已提交
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790
}

// 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
}

xurime's avatar
xurime 已提交
791 792 793 794 795 796 797 798 799 800 801 802 803 804
// formatPanes directly maps the settings of the panes.
type formatPanes struct {
	Freeze      bool   `json:"freeze"`
	Split       bool   `json:"split"`
	XSplit      int    `json:"x_split"`
	YSplit      int    `json:"y_split"`
	TopLeftCell string `json:"top_left_cell"`
	ActivePane  string `json:"active_pane"`
	Panes       []struct {
		SQRef      string `json:"sqref"`
		ActiveCell string `json:"active_cell"`
		Pane       string `json:"pane"`
	} `json:"panes"`
}
805

xurime's avatar
xurime 已提交
806
// formatConditional directly maps the conditional format settings of the cells.
807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829
type formatConditional struct {
	Type         string `json:"type"`
	AboveAverage bool   `json:"above_average"`
	Percent      bool   `json:"percent"`
	Format       int    `json:"format"`
	Criteria     string `json:"criteria"`
	Value        string `json:"value,omitempty"`
	Minimum      string `json:"minimum,omitempty"`
	Maximum      string `json:"maximum,omitempty"`
	MinType      string `json:"min_type,omitempty"`
	MidType      string `json:"mid_type,omitempty"`
	MaxType      string `json:"max_type,omitempty"`
	MinValue     string `json:"min_value,omitempty"`
	MidValue     string `json:"mid_value,omitempty"`
	MaxValue     string `json:"max_value,omitempty"`
	MinColor     string `json:"min_color,omitempty"`
	MidColor     string `json:"mid_color,omitempty"`
	MaxColor     string `json:"max_color,omitempty"`
	MinLength    string `json:"min_length,omitempty"`
	MaxLength    string `json:"max_length,omitempty"`
	MultiRange   string `json:"multi_range,omitempty"`
	BarColor     string `json:"bar_color,omitempty"`
}
830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849

// 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
}
850 851 852 853 854 855 856 857 858 859 860 861 862 863

// 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
}
864 865 866 867 868 869 870 871 872 873

// FormatPageMargins directly maps the settings of page margins
type FormatPageMargins struct {
	Bottom string
	Footer string
	Header string
	Left   string
	Right  string
	Top    string
}