diff options
author | Ri Xu <xuri.me@gmail.com> | 2017-01-18 16:05:01 +0800 |
---|---|---|
committer | Ri Xu <xuri.me@gmail.com> | 2017-01-18 16:05:01 +0800 |
commit | 52796f6e58e95145e2964d0d313a2f721dcc040e (patch) | |
tree | 721e818837035953828c75e102aa7dede7f91492 /xmlWorksheet.go | |
parent | f05df2a0182ee5761f5fbe7e56020313a0ab0b61 (diff) |
Format commants, break comments after 80 characters.
Diffstat (limited to 'xmlWorksheet.go')
-rw-r--r-- | xmlWorksheet.go | 221 |
1 files changed, 101 insertions, 120 deletions
diff --git a/xmlWorksheet.go b/xmlWorksheet.go index bc17403..2dbb1b1 100644 --- a/xmlWorksheet.go +++ b/xmlWorksheet.go @@ -3,9 +3,8 @@ 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 - currently I have +// not checked it for completeness - it does as much as I need. type xlsxWorksheet struct { XMLName xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main worksheet"` SheetPr *xlsxSheetPr `xml:"sheetPr"` @@ -35,13 +34,12 @@ type xlsxDrawing struct { } // xlsxHeaderFooter directly maps the headerFooter element in the namespace -// 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. +// 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. type xlsxHeaderFooter struct { DifferentFirst bool `xml:"differentFirst,attr,omitempty"` DifferentOddEven bool `xml:"differentOddEven,attr,omitempty"` @@ -50,24 +48,22 @@ type xlsxHeaderFooter struct { } // 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. +// 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. +// 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"` } // xlsxPageSetUp directly maps the pageSetup element in the namespace -// http://schemas.openxmlformats.org/spreadsheetml/2006/main - -// Page setup settings for the worksheet. +// 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"` @@ -91,9 +87,9 @@ type xlsxPageSetUp struct { } // xlsxPrintOptions directly maps the printOptions element in the namespace -// http://schemas.openxmlformats.org/spreadsheetml/2006/main - -// Print options for the sheet. Printer-specific settings are stored separately -// in the Printer Settings part. +// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Print options for +// 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"` @@ -103,8 +99,8 @@ type xlsxPrintOptions struct { } // 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. +// 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"` @@ -115,9 +111,8 @@ type xlsxPageMargins struct { } // xlsxSheetFormatPr directly maps the sheetFormatPr 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 - currently I have +// not checked it for completeness - it does as much as I need. type xlsxSheetFormatPr struct { DefaultColWidth float64 `xml:"defaultColWidth,attr,omitempty"` DefaultRowHeight float64 `xml:"defaultRowHeight,attr"` @@ -128,24 +123,21 @@ type xlsxSheetFormatPr struct { } // xlsxSheetViews directly maps the sheetViews element in the namespace -// http://schemas.openxmlformats.org/spreadsheetml/2006/main - -// Worksheet views collection. +// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Worksheet views +// collection. type xlsxSheetViews struct { SheetView []xlsxSheetView `xml:"sheetView"` } // xlsxSheetView directly maps the sheetView 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. -// -// 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 +// http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have +// not checked it for completeness - it does as much as I need. 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. type xlsxSheetView struct { WindowProtection bool `xml:"windowProtection,attr,omitempty"` @@ -169,8 +161,8 @@ type xlsxSheetView struct { } // xlsxSelection directly maps the selection element in the namespace -// http://schemas.openxmlformats.org/spreadsheetml/2006/main - -// Worksheet view selection. +// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Worksheet view +// selection. type xlsxSelection struct { ActiveCell string `xml:"activeCell,attr,omitempty"` ActiveCellID int `xml:"activeCellId,attr"` @@ -178,8 +170,7 @@ type xlsxSelection struct { SQRef string `xml:"sqref,attr,omitempty"` } -// xlsxSelection directly maps the selection element. -// Worksheet view pane. +// xlsxSelection directly maps the selection element. Worksheet view pane. type xlsxPane struct { ActivePane string `xml:"activePane,attr,omitempty"` State string `xml:"state,attr,omitempty"` // Either "split" or "frozen" @@ -189,8 +180,8 @@ type xlsxPane struct { } // xlsxSheetPr directly maps the sheetPr element in the namespace -// http://schemas.openxmlformats.org/spreadsheetml/2006/main - -// Sheet-level properties. +// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Sheet-level +// properties. type xlsxSheetPr struct { XMLName xml.Name `xml:"sheetPr"` CodeName string `xml:"codeName,attr,omitempty"` @@ -205,25 +196,23 @@ type xlsxSheetPr struct { } // xlsxPageSetUpPr directly maps the pageSetupPr element in the namespace -// http://schemas.openxmlformats.org/spreadsheetml/2006/main - -// Page setup properties of the worksheet. +// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Page setup +// properties of the worksheet. type xlsxPageSetUpPr struct { AutoPageBreaks bool `xml:"autoPageBreaks,attr,omitempty"` FitToPage bool `xml:"fitToPage,attr,omitempty"` // Flag indicating whether the Fit to Page print option is enabled. } -// xlsxTabColor directly maps the tabColor element in the namespace -// currently I have not checked it for completeness - it does as much -// as I need. +// 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 { - Theme int `xml:"theme,attr,omitempty"` // (Theme Color) A zero-based index into the <clrScheme> collection (§20.1.6.2), referencing a particular <sysClr> or <srgbClr> value expressed in the Theme part. - Tint uint8 `xml:"tint,attr,omitempty"` // Specifies the tint value applied to the color. + Theme int `xml:"theme,attr,omitempty"` + Tint uint8 `xml:"tint,attr,omitempty"` } // xlsxCols directly maps the cols 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 - currently I have +// not checked it for completeness - it does as much as I need. type xlsxCols struct { Col []xlsxCol `xml:"col"` } @@ -244,28 +233,27 @@ type xlsxCol struct { } // xlsxDimension directly maps the dimension element in the namespace -// http://schemas.openxmlformats.org/spreadsheetml/2006/main - -// This element specifies the used range of the worksheet. It specifies -// the row and column 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. +// http://schemas.openxmlformats.org/spreadsheetml/2006/main - This element +// specifies the used range of the worksheet. It specifies the row and column +// 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. type xlsxDimension struct { Ref string `xml:"ref,attr"` } // xlsxSheetData directly maps the sheetData 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 - currently I have +// not checked it for completeness - it does as much as I need. type xlsxSheetData struct { XMLName xml.Name `xml:"sheetData"` Row []xlsxRow `xml:"row"` } // xlsxRow directly maps the row element. The element expresses information -// about an entire row of a worksheet, and contains all cell definitions for -// a particular row in the worksheet. +// about an entire row of a worksheet, and contains all cell definitions for a +// particular row in the worksheet. type xlsxRow struct { Collapsed bool `xml:"collapsed,attr,omitempty"` CustomFormat bool `xml:"customFormat,attr,omitempty"` @@ -284,20 +272,19 @@ type xlsxRow struct { // xlsxMergeCell directly maps the mergeCell element. A single merged cell. type xlsxMergeCell struct { - Ref string `xml:"ref,attr,omitempty"` // ref: horiz "A1:C1", vert "B3:B6", both "D3:G4" + Ref string `xml:"ref,attr,omitempty"` } -// xlsxMergeCells directly maps the mergeCells element. This collection expresses -// all the merged cells in the sheet. +// 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"` } // xlsxC directly maps the c 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 - currently I have +// not checked it for completeness - it does as much as I need. type xlsxC struct { R string `xml:"r,attr"` // Cell ID, e.g. A1 S int `xml:"s,attr,omitempty"` // Style reference. @@ -308,9 +295,8 @@ type xlsxC struct { } // xlsxF directly maps the f 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 - currently I have +// not checked it for completeness - it does as much as I need. type xlsxF struct { Content string `xml:",chardata"` T string `xml:"t,attr,omitempty"` // Formula type @@ -318,8 +304,8 @@ type xlsxF struct { Si string `xml:"si,attr,omitempty"` // Shared formula index } -// xlsxSheetProtection collection expresses the sheet protection options -// to enforce when the sheet is protected. +// 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"` @@ -343,19 +329,18 @@ type xlsxSheetProtection struct { SpinCount int `xml:"spinCount,attr,omitempty"` } -// 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. +// 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. type xlsxConditionalFormatting struct { CfRule string `xml:",innerxml"` } // xlsxHyperlinks directly maps the hyperlinks element in the namespace -// 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. +// 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. type xlsxHyperlinks struct { Hyperlink []xlsxHyperlink `xml:"hyperlink"` } @@ -370,31 +355,28 @@ type xlsxHyperlink struct { } // xlsxTableParts directly maps the tableParts element in the namespace -// 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 +// 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 // names. // To add columns to your table you add new tableColumn elements to the -// 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. -// Example: +// 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: // // <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"> // ... @@ -415,25 +397,24 @@ type xlsxTablePart struct { } // xlsxPicture directly maps the picture element in the namespace -// http://schemas.openxmlformats.org/spreadsheetml/2006/main - -// Background sheet image. -// Example: +// http://schemas.openxmlformats.org/spreadsheetml/2006/main - Background sheet +// image. For example: // // <picture r:id="rId1"/> // type xlsxPicture struct { - RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"` // Relationship Id pointing to the image part. + RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"` } // xlsxLegacyDrawing directly maps the legacyDrawing element in the namespace -// 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. +// 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. type xlsxLegacyDrawing struct { RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"` } |