Ver Fonte

Format commants, break comments after 80 characters.

Ri Xu há 9 anos atrás
pai
commit
52796f6e58
14 ficheiros alterados com 342 adições e 346 exclusões
  1. 4 3
      cell.go
  2. 2 2
      col.go
  3. 12 8
      excelize.go
  4. 23 23
      excelize_test.go
  5. 8 5
      file.go
  6. 9 9
      lib.go
  7. 26 20
      picture.go
  8. 2 3
      rows.go
  9. 27 23
      sheet.go
  10. 8 6
      xmlDecodeDrawing.go
  11. 58 52
      xmlDrawing.go
  12. 6 8
      xmlSharedStrings.go
  13. 56 64
      xmlWorkbook.go
  14. 101 120
      xmlWorksheet.go

+ 4 - 3
cell.go

@@ -6,8 +6,8 @@ import (
 	"strings"
 	"strings"
 )
 )
 
 
-// GetCellValue provide function get value from cell by given sheet index and axis in XLSX file.
-// The value of the merged cell is not available currently.
+// GetCellValue provide function get value from cell by given sheet index and
+// axis in XLSX file. The value of the merged cell is not available currently.
 func (f *File) GetCellValue(sheet string, axis string) string {
 func (f *File) GetCellValue(sheet string, axis string) string {
 	axis = strings.ToUpper(axis)
 	axis = strings.ToUpper(axis)
 	var xlsx xlsxWorksheet
 	var xlsx xlsxWorksheet
@@ -50,7 +50,8 @@ func (f *File) GetCellValue(sheet string, axis string) string {
 	return ""
 	return ""
 }
 }
 
 
-// GetCellFormula provide function get formula from cell by given sheet index and axis in XLSX file.
+// GetCellFormula provide function get formula from cell by given sheet index
+// and axis in XLSX file.
 func (f *File) GetCellFormula(sheet string, axis string) string {
 func (f *File) GetCellFormula(sheet string, axis string) string {
 	axis = strings.ToUpper(axis)
 	axis = strings.ToUpper(axis)
 	var xlsx xlsxWorksheet
 	var xlsx xlsxWorksheet

+ 2 - 2
col.go

@@ -5,8 +5,8 @@ import (
 	"strings"
 	"strings"
 )
 )
 
 
-// SetColWidth provides function to set the width of a single column or multiple columns.
-// For example:
+// SetColWidth provides function to set the width of a single column or multiple
+// columns. For example:
 //
 //
 //    xlsx := excelize.CreateFile()
 //    xlsx := excelize.CreateFile()
 //    xlsx.SetColWidth("Sheet1", "A", "H", 20)
 //    xlsx.SetColWidth("Sheet1", "A", "H", 20)

+ 12 - 8
excelize.go

@@ -8,15 +8,15 @@ import (
 	"strings"
 	"strings"
 )
 )
 
 
-// File define a populated xlsx.File struct.
+// File define a populated XLSX file struct.
 type File struct {
 type File struct {
 	XLSX       map[string]string
 	XLSX       map[string]string
 	Path       string
 	Path       string
 	SheetCount int
 	SheetCount int
 }
 }
 
 
-// OpenFile take the name of an XLSX file and returns a populated
-// xlsx.File struct for it.
+// OpenFile take the name of an XLSX file and returns a populated XLSX file
+// struct for it.
 func OpenFile(filename string) (*File, error) {
 func OpenFile(filename string) (*File, error) {
 	var f *zip.ReadCloser
 	var f *zip.ReadCloser
 	var err error
 	var err error
@@ -110,7 +110,8 @@ func (f *File) SetCellStr(sheet string, axis string, value string) {
 	f.saveFileList(name, replaceWorkSheetsRelationshipsNameSpace(string(output)))
 	f.saveFileList(name, replaceWorkSheetsRelationshipsNameSpace(string(output)))
 }
 }
 
 
-// SetCellDefault provides function to set string type value of a cell as default format without escaping the cell.
+// SetCellDefault provides function to set string type value of a cell as
+// default format without escaping the cell.
 func (f *File) SetCellDefault(sheet string, axis string, value string) {
 func (f *File) SetCellDefault(sheet string, axis string, value string) {
 	axis = strings.ToUpper(axis)
 	axis = strings.ToUpper(axis)
 	var xlsx xlsxWorksheet
 	var xlsx xlsxWorksheet
@@ -203,7 +204,8 @@ func completeRow(xlsx xlsxWorksheet, row int, cell int) xlsxWorksheet {
 	return xlsx
 	return xlsx
 }
 }
 
 
-// Replace xl/worksheets/sheet%d.xml XML tags to self-closing for compatible Office Excel 2007.
+// Replace xl/worksheets/sheet%d.xml XML tags to self-closing for compatible
+// Office Excel 2007.
 func replaceWorkSheetsRelationshipsNameSpace(workbookMarshal string) string {
 func replaceWorkSheetsRelationshipsNameSpace(workbookMarshal string) string {
 	oldXmlns := `<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`
 	oldXmlns := `<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`
 	newXmlns := `<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mx="http://schemas.microsoft.com/office/mac/excel/2008/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">`
 	newXmlns := `<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mx="http://schemas.microsoft.com/office/mac/excel/2008/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="urn:schemas-microsoft-com:mac:vml" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac" xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">`
@@ -211,7 +213,7 @@ func replaceWorkSheetsRelationshipsNameSpace(workbookMarshal string) string {
 	return workbookMarshal
 	return workbookMarshal
 }
 }
 
 
-// Check XML tags and fix discontinuous case, for example:
+// Check XML tags and fix discontinuous case. For example:
 //
 //
 //    <row r="15" spans="1:22" x14ac:dyDescent="0.2">
 //    <row r="15" spans="1:22" x14ac:dyDescent="0.2">
 //        <c r="A15" s="2" />
 //        <c r="A15" s="2" />
@@ -232,7 +234,8 @@ func replaceWorkSheetsRelationshipsNameSpace(workbookMarshal string) string {
 //        <c r="G15" s="1" />
 //        <c r="G15" s="1" />
 //    </row>
 //    </row>
 //
 //
-// Noteice: this method could be very slow for large spreadsheets (more than 3000 rows one sheet).
+// Noteice: this method could be very slow for large spreadsheets (more than
+// 3000 rows one sheet).
 func checkRow(xlsx xlsxWorksheet) xlsxWorksheet {
 func checkRow(xlsx xlsxWorksheet) xlsxWorksheet {
 	buffer := bytes.Buffer{}
 	buffer := bytes.Buffer{}
 	for k, v := range xlsx.SheetData.Row {
 	for k, v := range xlsx.SheetData.Row {
@@ -267,7 +270,8 @@ func checkRow(xlsx xlsxWorksheet) xlsxWorksheet {
 
 
 // UpdateLinkedValue fix linked values within a spreadsheet are not updating in
 // UpdateLinkedValue fix linked values within a spreadsheet are not updating in
 // Office Excel 2007 and 2010. This function will be remove value tag when met a
 // Office Excel 2007 and 2010. This function will be remove value tag when met a
-// cell have a linked value. Reference https://social.technet.microsoft.com/Forums/office/en-US/e16bae1f-6a2c-4325-8013-e989a3479066/excel-2010-linked-cells-not-updating?forum=excel
+// cell have a linked value. Reference
+// https://social.technet.microsoft.com/Forums/office/en-US/e16bae1f-6a2c-4325-8013-e989a3479066/excel-2010-linked-cells-not-updating?forum=excel
 //
 //
 // Notice: after open XLSX file Excel will be update linked value and generate
 // Notice: after open XLSX file Excel will be update linked value and generate
 // new value and will prompt save file or not.
 // new value and will prompt save file or not.

+ 23 - 23
excelize_test.go

@@ -112,10 +112,12 @@ func TestOpenFile(t *testing.T) {
 	if err != nil {
 	if err != nil {
 		t.Log(err)
 		t.Log(err)
 	}
 	}
+}
 
 
+func TestBrokenFile(t *testing.T) {
 	// Test write file with broken file struct.
 	// Test write file with broken file struct.
 	f2 := File{}
 	f2 := File{}
-	err = f2.Save()
+	err := f2.Save()
 	if err != nil {
 	if err != nil {
 		t.Log(err)
 		t.Log(err)
 	}
 	}
@@ -124,41 +126,39 @@ func TestOpenFile(t *testing.T) {
 	if err != nil {
 	if err != nil {
 		t.Log(err)
 		t.Log(err)
 	}
 	}
-}
 
 
-func TestCreateFile(t *testing.T) {
-	// Test create a XLSX file.
-	f3 := CreateFile()
-	f3.NewSheet(2, "XLSXSheet2")
-	f3.NewSheet(3, "XLSXSheet3")
-	f3.SetCellInt("Sheet2", "A23", 56)
-	f3.SetCellStr("SHEET1", "B20", "42")
-	f3.SetActiveSheet(0)
-	// Test add picture to sheet.
-	err := f3.AddPicture("Sheet1", "H2", "K12", "./test/images/excel.gif")
+	// Test set active sheet without BookViews and Sheets maps in xl/workbook.xml.
+	f3, err := OpenFile("./test/badWorkbook.xlsx")
+	f3.SetActiveSheet(2)
 	if err != nil {
 	if err != nil {
 		t.Log(err)
 		t.Log(err)
 	}
 	}
-	err = f3.AddPicture("Sheet1", "C2", "F12", "./test/images/excel.tif")
+
+	// Test open a XLSX file with given illegal path.
+	_, err = OpenFile("./test/Workbook.xlsx")
 	if err != nil {
 	if err != nil {
 		t.Log(err)
 		t.Log(err)
 	}
 	}
-	err = f3.WriteTo("./test/Workbook_3.xlsx")
+}
+
+func TestCreateFile(t *testing.T) {
+	// Test create a XLSX file.
+	f4 := CreateFile()
+	f4.NewSheet(2, "XLSXSheet2")
+	f4.NewSheet(3, "XLSXSheet3")
+	f4.SetCellInt("Sheet2", "A23", 56)
+	f4.SetCellStr("SHEET1", "B20", "42")
+	f4.SetActiveSheet(0)
+	// Test add picture to sheet.
+	err := f4.AddPicture("Sheet1", "H2", "K12", "./test/images/excel.gif")
 	if err != nil {
 	if err != nil {
 		t.Log(err)
 		t.Log(err)
 	}
 	}
-}
-
-func TestBrokenFile(t *testing.T) {
-	// Test set active sheet without BookViews and Sheets maps in xl/workbook.xml.
-	f4, err := OpenFile("./test/badWorkbook.xlsx")
-	f4.SetActiveSheet(2)
+	err = f4.AddPicture("Sheet1", "C2", "F12", "./test/images/excel.tif")
 	if err != nil {
 	if err != nil {
 		t.Log(err)
 		t.Log(err)
 	}
 	}
-
-	// Test open a XLSX file with given illegal path.
-	_, err = OpenFile("./test/Workbook.xlsx")
+	err = f4.WriteTo("./test/Workbook_3.xlsx")
 	if err != nil {
 	if err != nil {
 		t.Log(err)
 		t.Log(err)
 	}
 	}

+ 8 - 5
file.go

@@ -6,9 +6,11 @@ import (
 	"os"
 	"os"
 )
 )
 
 
-// CreateFile provide function to create new file by default template.
-// For example:
-// xlsx := CreateFile()
+// CreateFile provides function to create new file by default template. For
+// example:
+//
+//    xlsx := CreateFile()
+//
 func CreateFile() *File {
 func CreateFile() *File {
 	file := make(map[string]string)
 	file := make(map[string]string)
 	file["_rels/.rels"] = templateRels
 	file["_rels/.rels"] = templateRels
@@ -25,7 +27,7 @@ func CreateFile() *File {
 	}
 	}
 }
 }
 
 
-// Save provide function override the xlsx file with origin path.
+// Save provides function override the xlsx file with origin path.
 func (f *File) Save() error {
 func (f *File) Save() error {
 	buf := new(bytes.Buffer)
 	buf := new(bytes.Buffer)
 	w := zip.NewWriter(buf)
 	w := zip.NewWriter(buf)
@@ -51,7 +53,8 @@ func (f *File) Save() error {
 	return err
 	return err
 }
 }
 
 
-// WriteTo provide function create or update to an xlsx file at the provided path.
+// WriteTo provides function to create or update to an xlsx file at the provided
+// path.
 func (f *File) WriteTo(name string) error {
 func (f *File) WriteTo(name string) error {
 	buf := new(bytes.Buffer)
 	buf := new(bytes.Buffer)
 	w := zip.NewWriter(buf)
 	w := zip.NewWriter(buf)

+ 9 - 9
lib.go

@@ -9,16 +9,16 @@ import (
 	"math"
 	"math"
 )
 )
 
 
-// ReadZip takes a pointer to a zip.ReadCloser and returns a
-// xlsx.File struct populated with its contents. In most cases
-// ReadZip is not used directly, but is called internally by OpenFile.
+// ReadZip takes a pointer to a zip.ReadCloser and returns a xlsx.File struct
+// populated with its contents. In most cases ReadZip is not used directly, but
+// is called internally by OpenFile.
 func ReadZip(f *zip.ReadCloser) (map[string]string, int, error) {
 func ReadZip(f *zip.ReadCloser) (map[string]string, int, error) {
 	defer f.Close()
 	defer f.Close()
 	return ReadZipReader(&f.Reader)
 	return ReadZipReader(&f.Reader)
 }
 }
 
 
-// ReadZipReader can be used to read an XLSX in memory without
-// touching the filesystem.
+// ReadZipReader can be used to read an XLSX in memory without touching the
+// filesystem.
 func ReadZipReader(r *zip.Reader) (map[string]string, int, error) {
 func ReadZipReader(r *zip.Reader) (map[string]string, int, error) {
 	fileList := make(map[string]string)
 	fileList := make(map[string]string)
 	worksheets := 0
 	worksheets := 0
@@ -88,8 +88,8 @@ func titleToNumber(s string) int {
 	return sum - 1
 	return sum - 1
 }
 }
 
 
-// letterOnlyMapF is used in conjunction with strings.Map to return
-// only the characters A-Z and a-z in a string.
+// letterOnlyMapF is used in conjunction with strings.Map to return only the
+// characters A-Z and a-z in a string.
 func letterOnlyMapF(rune rune) rune {
 func letterOnlyMapF(rune rune) rune {
 	switch {
 	switch {
 	case 'A' <= rune && rune <= 'Z':
 	case 'A' <= rune && rune <= 'Z':
@@ -100,8 +100,8 @@ func letterOnlyMapF(rune rune) rune {
 	return -1
 	return -1
 }
 }
 
 
-// intOnlyMapF is used in conjunction with strings.Map to return only
-// the numeric portions of a string.
+// intOnlyMapF is used in conjunction with strings.Map to return only the
+// numeric portions of a string.
 func intOnlyMapF(rune rune) rune {
 func intOnlyMapF(rune rune) rune {
 	if rune >= 48 && rune < 58 {
 	if rune >= 48 && rune < 58 {
 		return rune
 		return rune

+ 26 - 20
picture.go

@@ -13,8 +13,8 @@ import (
 	"strings"
 	"strings"
 )
 )
 
 
-// AddPicture provide the method to add picture in a sheet by given xAxis, yAxis and file path.
-// For example:
+// AddPicture provide the method to add picture in a sheet by given xAxis, yAxis
+// and file path. For example:
 //
 //
 //    xlsx := excelize.CreateFile()
 //    xlsx := excelize.CreateFile()
 //    err := xlsx.AddPicture("Sheet1", "A2", "H9", "./image.jpg")
 //    err := xlsx.AddPicture("Sheet1", "A2", "H9", "./image.jpg")
@@ -63,8 +63,9 @@ func (f *File) AddPicture(sheet string, xAxis string, yAxis string, picture stri
 	return err
 	return err
 }
 }
 
 
-// addSheetRelationships provides function to add xl/worksheets/_rels/sheet%d.xml.rels by given
-// sheet name, relationship type and target.
+// addSheetRelationships provides function to add
+// xl/worksheets/_rels/sheet%d.xml.rels by given sheet name, relationship type
+// and target.
 func (f *File) addSheetRelationships(sheet string, relType string, target string) int {
 func (f *File) addSheetRelationships(sheet string, relType string, target string) int {
 	var rels = "xl/worksheets/_rels/" + strings.ToLower(sheet) + ".xml.rels"
 	var rels = "xl/worksheets/_rels/" + strings.ToLower(sheet) + ".xml.rels"
 	var sheetRels xlsxWorkbookRels
 	var sheetRels xlsxWorkbookRels
@@ -93,8 +94,8 @@ func (f *File) addSheetRelationships(sheet string, relType string, target string
 	return rID
 	return rID
 }
 }
 
 
-// addSheetDrawing provides function to add drawing element to xl/worksheets/sheet%d.xml by
-// given sheet name and relationship index.
+// addSheetDrawing provides function to add drawing element to
+// xl/worksheets/sheet%d.xml by given sheet name and relationship index.
 func (f *File) addSheetDrawing(sheet string, rID int) {
 func (f *File) addSheetDrawing(sheet string, rID int) {
 	var xlsx xlsxWorksheet
 	var xlsx xlsxWorksheet
 	name := "xl/worksheets/" + strings.ToLower(sheet) + ".xml"
 	name := "xl/worksheets/" + strings.ToLower(sheet) + ".xml"
@@ -109,7 +110,8 @@ func (f *File) addSheetDrawing(sheet string, rID int) {
 	f.saveFileList(name, string(output))
 	f.saveFileList(name, string(output))
 }
 }
 
 
-// countDrawings provides function to get drawing files count storage in the folder xl/drawings.
+// countDrawings provides function to get drawing files count storage in the
+// folder xl/drawings.
 func (f *File) countDrawings() int {
 func (f *File) countDrawings() int {
 	count := 0
 	count := 0
 	for k := range f.XLSX {
 	for k := range f.XLSX {
@@ -120,10 +122,10 @@ func (f *File) countDrawings() int {
 	return count
 	return count
 }
 }
 
 
-// addDrawing provides function to add picture by given drawingXML, xAxis, yAxis, file name
-// and relationship index. In order to solve the problem that the label structure is changed
-// after serialization and deserialization, two different structures: decodeWsDr and encodeWsDr
-// are defined.
+// addDrawing provides function to add picture by given drawingXML, xAxis,
+// yAxis, file name and relationship index. In order to solve the problem that
+// the label structure is changed after serialization and deserialization, two
+// different structures: decodeWsDr and encodeWsDr are defined.
 func (f *File) addDrawing(drawingXML string, xAxis string, yAxis string, file string, rID int) {
 func (f *File) addDrawing(drawingXML string, xAxis string, yAxis string, file string, rID int) {
 	xAxis = strings.ToUpper(xAxis)
 	xAxis = strings.ToUpper(xAxis)
 	fromCol := string(strings.Map(letterOnlyMapF, xAxis))
 	fromCol := string(strings.Map(letterOnlyMapF, xAxis))
@@ -186,8 +188,9 @@ func (f *File) addDrawing(drawingXML string, xAxis string, yAxis string, file st
 	f.saveFileList(drawingXML, result)
 	f.saveFileList(drawingXML, result)
 }
 }
 
 
-// addDrawingRelationships provides function to add image part relationships in the file
-// xl/drawings/_rels/drawing%d.xml.rels by given drawing index, relationship type and target.
+// addDrawingRelationships provides function to add image part relationships in
+// the file xl/drawings/_rels/drawing%d.xml.rels by given drawing index,
+// relationship type and target.
 func (f *File) addDrawingRelationships(index int, relType string, target string) int {
 func (f *File) addDrawingRelationships(index int, relType string, target string) int {
 	var rels = "xl/drawings/_rels/drawing" + strconv.Itoa(index) + ".xml.rels"
 	var rels = "xl/drawings/_rels/drawing" + strconv.Itoa(index) + ".xml.rels"
 	var drawingRels xlsxWorkbookRels
 	var drawingRels xlsxWorkbookRels
@@ -216,7 +219,8 @@ func (f *File) addDrawingRelationships(index int, relType string, target string)
 	return rID
 	return rID
 }
 }
 
 
-// countMedia provides function to get media files count storage in the folder xl/media/image.
+// countMedia provides function to get media files count storage in the folder
+// xl/media/image.
 func (f *File) countMedia() int {
 func (f *File) countMedia() int {
 	count := 0
 	count := 0
 	for k := range f.XLSX {
 	for k := range f.XLSX {
@@ -227,8 +231,8 @@ func (f *File) countMedia() int {
 	return count
 	return count
 }
 }
 
 
-// addMedia provides function to add picture into folder xl/media/image by given file
-// name and extension name.
+// addMedia provides function to add picture into folder xl/media/image by given
+// file name and extension name.
 func (f *File) addMedia(file string, ext string) {
 func (f *File) addMedia(file string, ext string) {
 	count := f.countMedia()
 	count := f.countMedia()
 	dat, _ := ioutil.ReadFile(file)
 	dat, _ := ioutil.ReadFile(file)
@@ -236,8 +240,9 @@ func (f *File) addMedia(file string, ext string) {
 	f.XLSX[media] = string(dat)
 	f.XLSX[media] = string(dat)
 }
 }
 
 
-// addDrawingContentTypePart provides function to add image part relationships in
-// http://purl.oclc.org/ooxml/officeDocument/relationships/image and appropriate content type.
+// addDrawingContentTypePart provides function to add image part relationships
+// in http://purl.oclc.org/ooxml/officeDocument/relationships/image and
+// appropriate content type.
 func (f *File) addDrawingContentTypePart(index int) {
 func (f *File) addDrawingContentTypePart(index int) {
 	var imageTypes = map[string]bool{"jpeg": false, "png": false, "gif": false, "tiff": false}
 	var imageTypes = map[string]bool{"jpeg": false, "png": false, "gif": false, "tiff": false}
 	var content xlsxTypes
 	var content xlsxTypes
@@ -271,8 +276,9 @@ func (f *File) addDrawingContentTypePart(index int) {
 	f.saveFileList(`[Content_Types].xml`, string(output))
 	f.saveFileList(`[Content_Types].xml`, string(output))
 }
 }
 
 
-// getSheetRelationshipsTargetByID provides function to get Target attribute value
-// in xl/worksheets/_rels/sheet%d.xml.rels by given sheet name and relationship index.
+// getSheetRelationshipsTargetByID provides function to get Target attribute
+// value in xl/worksheets/_rels/sheet%d.xml.rels by given sheet name and
+// relationship index.
 func (f *File) getSheetRelationshipsTargetByID(sheet string, rID string) string {
 func (f *File) getSheetRelationshipsTargetByID(sheet string, rID string) string {
 	var rels = "xl/worksheets/_rels/" + strings.ToLower(sheet) + ".xml.rels"
 	var rels = "xl/worksheets/_rels/" + strings.ToLower(sheet) + ".xml.rels"
 	var sheetRels xlsxWorkbookRels
 	var sheetRels xlsxWorkbookRels

+ 2 - 3
rows.go

@@ -43,9 +43,8 @@ func readXMLSST(f *File) (xlsxSST, error) {
 	return shardStrings, err
 	return shardStrings, err
 }
 }
 
 
-// getValueFrom return a value from a column/row cell,
-// this function is inteded to be used with for range on rows
-// an argument with the xlsx opened file.
+// getValueFrom return a value from a column/row cell, this function is inteded
+// to be used with for range on rows an argument with the xlsx opened file.
 func (xlsx *xlsxC) getValueFrom(f *File) (string, error) {
 func (xlsx *xlsxC) getValueFrom(f *File) (string, error) {
 	switch xlsx.T {
 	switch xlsx.T {
 	case "s":
 	case "s":

+ 27 - 23
sheet.go

@@ -8,9 +8,10 @@ import (
 	"strings"
 	"strings"
 )
 )
 
 
-// NewSheet provice function to greate a new sheet by given index, when
-// creating a new XLSX file, the default sheet will be create, when you
-// create a new file, you need to ensure that the index is continuous.
+// Sprint formats using the default formats for its operands and returns the
+// resulting string. NewSheet provice function to greate a new sheet by given
+// index, when creating a new XLSX file, the default sheet will be create, when
+// you create a new file, you need to ensure that the index is continuous.
 func (f *File) NewSheet(index int, name string) {
 func (f *File) NewSheet(index int, name string) {
 	// Update docProps/app.xml
 	// Update docProps/app.xml
 	f.setAppXML()
 	f.setAppXML()
@@ -54,7 +55,8 @@ func (f *File) setSheet(index int) {
 	f.saveFileList(path, replaceWorkSheetsRelationshipsNameSpace(string(output)))
 	f.saveFileList(path, replaceWorkSheetsRelationshipsNameSpace(string(output)))
 }
 }
 
 
-// Update workbook property of XLSX. Maximum 31 characters are allowed in sheet title.
+// setWorkbook update workbook property of XLSX. Maximum 31 characters are
+// allowed in sheet title.
 func (f *File) setWorkbook(name string, rid int) {
 func (f *File) setWorkbook(name string, rid int) {
 	var content xlsxWorkbook
 	var content xlsxWorkbook
 	r := strings.NewReplacer(":", "", "\\", "", "/", "", "?", "", "*", "", "[", "", "]", "")
 	r := strings.NewReplacer(":", "", "\\", "", "/", "", "?", "", "*", "", "[", "", "]", "")
@@ -75,14 +77,14 @@ func (f *File) setWorkbook(name string, rid int) {
 	f.saveFileList("xl/workbook.xml", replaceRelationshipsNameSpace(string(output)))
 	f.saveFileList("xl/workbook.xml", replaceRelationshipsNameSpace(string(output)))
 }
 }
 
 
-// Read and unmarshal workbook relationships of XLSX.
+// readXlsxWorkbookRels read and unmarshal workbook relationships of XLSX file.
 func (f *File) readXlsxWorkbookRels() xlsxWorkbookRels {
 func (f *File) readXlsxWorkbookRels() xlsxWorkbookRels {
 	var content xlsxWorkbookRels
 	var content xlsxWorkbookRels
 	xml.Unmarshal([]byte(f.readXML("xl/_rels/workbook.xml.rels")), &content)
 	xml.Unmarshal([]byte(f.readXML("xl/_rels/workbook.xml.rels")), &content)
 	return content
 	return content
 }
 }
 
 
-// Update workbook relationships property of XLSX.
+// addXlsxWorkbookRels update workbook relationships property of XLSX.
 func (f *File) addXlsxWorkbookRels(sheet int) int {
 func (f *File) addXlsxWorkbookRels(sheet int) int {
 	content := f.readXlsxWorkbookRels()
 	content := f.readXlsxWorkbookRels()
 	rID := len(content.Relationships) + 1
 	rID := len(content.Relationships) + 1
@@ -106,25 +108,26 @@ func (f *File) addXlsxWorkbookRels(sheet int) int {
 	return rID
 	return rID
 }
 }
 
 
-// Update docProps/app.xml file of XML.
+// setAppXML update docProps/app.xml file of XML.
 func (f *File) setAppXML() {
 func (f *File) setAppXML() {
 	f.saveFileList("docProps/app.xml", templateDocpropsApp)
 	f.saveFileList("docProps/app.xml", templateDocpropsApp)
 }
 }
 
 
-// Some tools that read XLSX files have very strict requirements about
-// the structure of the input XML.  In particular both Numbers on the Mac
-// and SAS dislike inline XML namespace declarations, or namespace
-// prefixes that don't match the ones that Excel itself uses.  This is a
-// problem because the Go XML library doesn't multiple namespace
-// declarations in a single element of a document.  This function is a
-// horrible hack to fix that after the XML marshalling is completed.
+// Some tools that read XLSX files have very strict requirements about the
+// structure of the input XML. In particular both Numbers on the Mac and SAS
+// dislike inline XML namespace declarations, or namespace prefixes that don't
+// match the ones that Excel itself uses. This is a problem because the Go XML
+// library doesn't multiple namespace declarations in a single element of a
+// document. This function is a horrible hack to fix that after the XML
+// marshalling is completed.
 func replaceRelationshipsNameSpace(workbookMarshal string) string {
 func replaceRelationshipsNameSpace(workbookMarshal string) string {
 	oldXmlns := `<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`
 	oldXmlns := `<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">`
 	newXmlns := `<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main">`
 	newXmlns := `<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x15" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main">`
 	return strings.Replace(workbookMarshal, oldXmlns, newXmlns, -1)
 	return strings.Replace(workbookMarshal, oldXmlns, newXmlns, -1)
 }
 }
 
 
-// SetActiveSheet provide function to set default active sheet of XLSX by given index.
+// SetActiveSheet provide function to set default active sheet of XLSX by given
+// index.
 func (f *File) SetActiveSheet(index int) {
 func (f *File) SetActiveSheet(index int) {
 	var content xlsxWorkbook
 	var content xlsxWorkbook
 	if index < 1 {
 	if index < 1 {
@@ -177,8 +180,8 @@ func (f *File) SetActiveSheet(index int) {
 	return
 	return
 }
 }
 
 
-// GetActiveSheetIndex provides function to get active sheet of XLSX. If not found
-// the active sheet will be return integer 0.
+// GetActiveSheetIndex provides function to get active sheet of XLSX. If not
+// found the active sheet will be return integer 0.
 func (f *File) GetActiveSheetIndex() int {
 func (f *File) GetActiveSheetIndex() int {
 	content := xlsxWorkbook{}
 	content := xlsxWorkbook{}
 	buffer := bytes.Buffer{}
 	buffer := bytes.Buffer{}
@@ -200,10 +203,11 @@ func (f *File) GetActiveSheetIndex() int {
 	return 0
 	return 0
 }
 }
 
 
-// SetSheetName provides function to set the sheet name be given old and new sheet name.
-// Maximum 31 characters are allowed in sheet title and this function only changes the
-// name of the sheet and will not update the sheet name in the formula or reference
-// associated with the cell. So there may be problem formula error or reference missing.
+// SetSheetName provides function to set the sheet name be given old and new
+// sheet name. Maximum 31 characters are allowed in sheet title and this
+// function only changes the name of the sheet and will not update the sheet
+// name in the formula or reference associated with the cell. So there may be
+// problem formula error or reference missing.
 func (f *File) SetSheetName(oldName, newName string) {
 func (f *File) SetSheetName(oldName, newName string) {
 	var content = xlsxWorkbook{}
 	var content = xlsxWorkbook{}
 	r := strings.NewReplacer(":", "", "\\", "", "/", "", "?", "", "*", "", "[", "", "]", "")
 	r := strings.NewReplacer(":", "", "\\", "", "/", "", "?", "", "*", "", "[", "", "]", "")
@@ -221,8 +225,8 @@ func (f *File) SetSheetName(oldName, newName string) {
 	f.saveFileList("xl/workbook.xml", replaceRelationshipsNameSpace(string(output)))
 	f.saveFileList("xl/workbook.xml", replaceRelationshipsNameSpace(string(output)))
 }
 }
 
 
-// GetSheetName provides function to get sheet name of XLSX by given sheet index.
-// If given sheet index is invalid, will return an empty string.
+// GetSheetName provides function to get sheet name of XLSX by given sheet
+// index. If given sheet index is invalid, will return an empty string.
 func (f *File) GetSheetName(index int) string {
 func (f *File) GetSheetName(index int) string {
 	var content = xlsxWorkbook{}
 	var content = xlsxWorkbook{}
 	xml.Unmarshal([]byte(f.readXML("xl/workbook.xml")), &content)
 	xml.Unmarshal([]byte(f.readXML("xl/workbook.xml")), &content)

+ 8 - 6
xmlDecodeDrawing.go

@@ -2,17 +2,19 @@ package excelize
 
 
 import "encoding/xml"
 import "encoding/xml"
 
 
-// decodeTwoCellAnchor directly maps the twoCellAnchor (Two Cell Anchor Shape Size). This element
-// specifies a two cell anchor placeholder for a group, a shape, or a drawing element. It moves
-// with cells and its extents are in EMU units.
+// decodeTwoCellAnchor directly maps the twoCellAnchor (Two Cell Anchor Shape
+// Size). This element specifies a two cell anchor placeholder for a group, a
+// shape, or a drawing element. It moves with cells and its extents are in EMU
+// units.
 type decodeTwoCellAnchor struct {
 type decodeTwoCellAnchor struct {
 	EditAs  string `xml:"editAs,attr,omitempty"`
 	EditAs  string `xml:"editAs,attr,omitempty"`
 	Content string `xml:",innerxml"`
 	Content string `xml:",innerxml"`
 }
 }
 
 
-// decodeWsDr directly maps the root element for a part of this content type shall wsDr.
-// In order to solve the problem that the label structure is changed after serialization
-// and deserialization, two different structures are defined. decodeWsDr just for deserialization.
+// decodeWsDr directly maps the root element for a part of this content type
+// shall wsDr. In order to solve the problem that the label structure is changed
+// after serialization and deserialization, two different structures are
+// defined. decodeWsDr just for deserialization.
 type decodeWsDr struct {
 type decodeWsDr struct {
 	A             string                 `xml:"xmlns a,attr"`
 	A             string                 `xml:"xmlns a,attr"`
 	Xdr           string                 `xml:"xmlns xdr,attr"`
 	Xdr           string                 `xml:"xmlns xdr,attr"`

+ 58 - 52
xmlDrawing.go

@@ -10,10 +10,9 @@ const (
 	NameSpaceSpreadSheetDrawing = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
 	NameSpaceSpreadSheetDrawing = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
 )
 )
 
 
-// xlsxCNvPr directly maps the cNvPr (Non-Visual Drawing Properties).
-// This element specifies non-visual canvas properties. This allows for
-// additional information that does not affect the appearance of the
-// picture to be stored.
+// xlsxCNvPr directly maps the cNvPr (Non-Visual Drawing Properties). This
+// element specifies non-visual canvas properties. This allows for additional
+// information that does not affect the appearance of the picture to be stored.
 type xlsxCNvPr struct {
 type xlsxCNvPr struct {
 	ID    int    `xml:"id,attr"`
 	ID    int    `xml:"id,attr"`
 	Name  string `xml:"name,attr"`
 	Name  string `xml:"name,attr"`
@@ -22,9 +21,9 @@ type xlsxCNvPr struct {
 }
 }
 
 
 // xlsxPicLocks directly maps the picLocks (Picture Locks). This element
 // xlsxPicLocks directly maps the picLocks (Picture Locks). This element
-// specifies all locking properties for a graphic frame. These properties
-// inform the generating application about specific properties that have
-// been previously locked and thus should not be changed.
+// specifies all locking properties for a graphic frame. These properties inform
+// the generating application about specific properties that have been
+// previously locked and thus should not be changed.
 type xlsxPicLocks struct {
 type xlsxPicLocks struct {
 	NoAdjustHandles    bool `xml:"noAdjustHandles,attr,omitempty"`
 	NoAdjustHandles    bool `xml:"noAdjustHandles,attr,omitempty"`
 	NoChangeArrowheads bool `xml:"noChangeArrowheads,attr,omitempty"`
 	NoChangeArrowheads bool `xml:"noChangeArrowheads,attr,omitempty"`
@@ -39,25 +38,25 @@ type xlsxPicLocks struct {
 	NoSelect           bool `xml:"noSelect,attr,omitempty"`
 	NoSelect           bool `xml:"noSelect,attr,omitempty"`
 }
 }
 
 
-// xlsxBlip directly maps the blip element in the namespace
-// http://purl.oclc.or g/ooxml/officeDoc ument/relationships -
-// This element specifies the existence of an image (binary large image or
-// picture) and contains a reference to the image data.
+// xlsxBlip directly maps the blip element in the namespace http://purl.oclc.or
+// g/ooxml/officeDoc ument/relationships - This element specifies the existence
+// of an image (binary large image or picture) and contains a reference to the
+// image data.
 type xlsxBlip struct {
 type xlsxBlip struct {
 	Embed  string `xml:"r:embed,attr"`
 	Embed  string `xml:"r:embed,attr"`
 	Cstate string `xml:"cstate,attr,omitempty"`
 	Cstate string `xml:"cstate,attr,omitempty"`
 	R      string `xml:"xmlns:r,attr"`
 	R      string `xml:"xmlns:r,attr"`
 }
 }
 
 
-// xlsxStretch directly maps the stretch element. This element specifies
-// that a BLIP should be stretched to fill the target rectangle. The other
-// option is a tile where a BLIP is tiled to fill the available area.
+// xlsxStretch directly maps the stretch element. This element specifies that a
+// BLIP should be stretched to fill the target rectangle. The other option is a
+// tile where a BLIP is tiled to fill the available area.
 type xlsxStretch struct {
 type xlsxStretch struct {
 	FillRect string `xml:"a:fillRect"`
 	FillRect string `xml:"a:fillRect"`
 }
 }
 
 
-// xlsxOff directly maps the colOff and rowOff element. This element is used
-// to specify the column offset within a cell.
+// xlsxOff directly maps the colOff and rowOff element. This element is used to
+// specify the column offset within a cell.
 type xlsxOff struct {
 type xlsxOff struct {
 	X int `xml:"x,attr"`
 	X int `xml:"x,attr"`
 	Y int `xml:"y,attr"`
 	Y int `xml:"y,attr"`
@@ -69,61 +68,65 @@ type xlsxExt struct {
 	Cy int `xml:"cy,attr"`
 	Cy int `xml:"cy,attr"`
 }
 }
 
 
-// xlsxPrstGeom directly maps the prstGeom (Preset geometry). This element specifies
-// when a preset geometric shape should be used instead of a custom geometric shape.
-// The generating application should be able to render all preset geometries enumerated
-// in the ST_ShapeType list.
+// xlsxPrstGeom directly maps the prstGeom (Preset geometry). This element
+// specifies when a preset geometric shape should be used instead of a custom
+// geometric shape. The generating application should be able to render all
+// preset geometries enumerated in the ST_ShapeType list.
 type xlsxPrstGeom struct {
 type xlsxPrstGeom struct {
 	Prst string `xml:"prst,attr"`
 	Prst string `xml:"prst,attr"`
 }
 }
 
 
-// xlsxXfrm directly maps the xfrm (2D Transform for Graphic Frame). This element
-// specifies the transform to be applied to the corresponding graphic frame. This
-// transformation is applied to the graphic frame just as it would be for a shape
-// or group shape.
+// xlsxXfrm directly maps the xfrm (2D Transform for Graphic Frame). This
+// element specifies the transform to be applied to the corresponding graphic
+// frame. This transformation is applied to the graphic frame just as it would
+// be for a shape or group shape.
 type xlsxXfrm struct {
 type xlsxXfrm struct {
 	Off xlsxOff `xml:"a:off"`
 	Off xlsxOff `xml:"a:off"`
 	Ext xlsxExt `xml:"a:ext"`
 	Ext xlsxExt `xml:"a:ext"`
 }
 }
 
 
-// xlsxCNvPicPr directly maps the cNvPicPr (Non-Visual Picture Drawing Properties).
-// This element specifies the non-visual properties for the picture canvas. These
-// properties are to be used by the generating application to determine how certain
-// properties are to be changed for the picture object in question.
+// xlsxCNvPicPr directly maps the cNvPicPr (Non-Visual Picture Drawing
+// Properties). This element specifies the non-visual properties for the picture
+// canvas. These properties are to be used by the generating application to
+// determine how certain properties are to be changed for the picture object in
+// question.
 type xlsxCNvPicPr struct {
 type xlsxCNvPicPr struct {
 	PicLocks xlsxPicLocks `xml:"a:picLocks"`
 	PicLocks xlsxPicLocks `xml:"a:picLocks"`
 }
 }
 
 
-// directly maps the nvPicPr (Non-Visual Properties for a Picture). This element specifies
-// all non-visual properties for a picture. This element is a container for the non-visual
-// identification properties, shape properties and application properties that are to be
-// associated with a picture. This allows for additional information that does not affect
-// the appearance of the picture to be stored.
+// directly maps the nvPicPr (Non-Visual Properties for a Picture). This element
+// specifies all non-visual properties for a picture. This element is a
+// container for the non-visual identification properties, shape properties and
+// application properties that are to be associated with a picture. This allows
+// for additional information that does not affect the appearance of the picture
+// to be stored.
 type xlsxNvPicPr struct {
 type xlsxNvPicPr struct {
 	CNvPr    xlsxCNvPr    `xml:"xdr:cNvPr"`
 	CNvPr    xlsxCNvPr    `xml:"xdr:cNvPr"`
 	CNvPicPr xlsxCNvPicPr `xml:"xdr:cNvPicPr"`
 	CNvPicPr xlsxCNvPicPr `xml:"xdr:cNvPicPr"`
 }
 }
 
 
-// xlsxBlipFill directly maps the blipFill (Picture Fill). This element specifies the kind
-// of picture fill that the picture object has. Because a picture has a picture fill already
-// by default, it is possible to have two fills specified for a picture object.
+// xlsxBlipFill directly maps the blipFill (Picture Fill). This element
+// specifies the kind of picture fill that the picture object has. Because a
+// picture has a picture fill already by default, it is possible to have two
+// fills specified for a picture object.
 type xlsxBlipFill struct {
 type xlsxBlipFill struct {
 	Blip    xlsxBlip    `xml:"a:blip"`
 	Blip    xlsxBlip    `xml:"a:blip"`
 	Stretch xlsxStretch `xml:"a:stretch"`
 	Stretch xlsxStretch `xml:"a:stretch"`
 }
 }
 
 
-// xlsxSpPr directly maps the spPr (Shape Properties). This element specifies the visual shape
-// properties that can be applied to a picture. These are the same properties that are allowed
-// to describe the visual properties of a shape but are used here to describe the visual
-// appearance of a picture within a document.
+// xlsxSpPr directly maps the spPr (Shape Properties). This element specifies the visual
+// shape properties that can be applied to a picture. These are the same properties that
+// are allowed to describe the visual properties of a shape but are used here to describe
+// the visual appearance of a picture within a document.
 type xlsxSpPr struct {
 type xlsxSpPr struct {
 	Xfrm     xlsxXfrm     `xml:"a:xfrm"`
 	Xfrm     xlsxXfrm     `xml:"a:xfrm"`
 	PrstGeom xlsxPrstGeom `xml:"a:prstGeom"`
 	PrstGeom xlsxPrstGeom `xml:"a:prstGeom"`
 }
 }
 
 
-// xlsxPic elements encompass the definition of pictures within the DrawingML framework. While
-// pictures are in many ways very similar to shapes they have specific properties that are unique
-// in order to optimize for picture- specific scenarios.
+// xlsxPic elements encompass the definition of pictures within the DrawingML
+// framework. While pictures are in many ways very similar to shapes they have
+// specific properties that are unique in order to optimize for picture-
+// specific scenarios.
 type xlsxPic struct {
 type xlsxPic struct {
 	NvPicPr  xlsxNvPicPr  `xml:"xdr:nvPicPr"`
 	NvPicPr  xlsxNvPicPr  `xml:"xdr:nvPicPr"`
 	BlipFill xlsxBlipFill `xml:"xdr:blipFill"`
 	BlipFill xlsxBlipFill `xml:"xdr:blipFill"`
@@ -146,19 +149,21 @@ type xlsxTo struct {
 	RowOff int `xml:"xdr:rowOff"`
 	RowOff int `xml:"xdr:rowOff"`
 }
 }
 
 
-// xlsxClientData directly maps the clientData element. An empty element which specifies (via
-// attributes) certain properties related to printing and selection of the drawing object. The
-// fLocksWithSheet attribute (either true or false) determines whether to disable selection when
-// the sheet is protected, and fPrintsWithSheet attribute (either true or false) determines whether
-// the object is printed when the sheet is printed.
+// xlsxClientData directly maps the clientData element. An empty element which
+// specifies (via attributes) certain properties related to printing and
+// selection of the drawing object. The fLocksWithSheet attribute (either true
+// or false) determines whether to disable selection when the sheet is
+// protected, and fPrintsWithSheet attribute (either true or false) determines
+// whether the object is printed when the sheet is printed.
 type xlsxClientData struct {
 type xlsxClientData struct {
 	FLocksWithSheet  bool `xml:"fLocksWithSheet,attr"`
 	FLocksWithSheet  bool `xml:"fLocksWithSheet,attr"`
 	FPrintsWithSheet bool `xml:"fPrintsWithSheet,attr"`
 	FPrintsWithSheet bool `xml:"fPrintsWithSheet,attr"`
 }
 }
 
 
-// xlsxTwoCellAnchor directly maps the twoCellAnchor (Two Cell Anchor Shape Size). This element
-// specifies a two cell anchor placeholder for a group, a shape, or a drawing element. It moves
-// with cells and its extents are in EMU units.
+// xlsxTwoCellAnchor directly maps the twoCellAnchor (Two Cell Anchor Shape
+// Size). This element specifies a two cell anchor placeholder for a group, a
+// shape, or a drawing element. It moves with cells and its extents are in EMU
+// units.
 type xlsxTwoCellAnchor struct {
 type xlsxTwoCellAnchor struct {
 	EditAs       string          `xml:"editAs,attr,omitempty"`
 	EditAs       string          `xml:"editAs,attr,omitempty"`
 	From         *xlsxFrom       `xml:"xdr:from"`
 	From         *xlsxFrom       `xml:"xdr:from"`
@@ -168,7 +173,8 @@ type xlsxTwoCellAnchor struct {
 	ClientData   *xlsxClientData `xml:"xdr:clientData"`
 	ClientData   *xlsxClientData `xml:"xdr:clientData"`
 }
 }
 
 
-// xlsxWsDr directly maps the root element for a part of this content type shall wsDr.
+// xlsxWsDr directly maps the root element for a part of this content type shall
+// wsDr.
 type xlsxWsDr struct {
 type xlsxWsDr struct {
 	TwoCellAnchor []*xlsxTwoCellAnchor `xml:"xdr:twoCellAnchor"`
 	TwoCellAnchor []*xlsxTwoCellAnchor `xml:"xdr:twoCellAnchor"`
 	Xdr           string               `xml:"xmlns:xdr,attr"`
 	Xdr           string               `xml:"xmlns:xdr,attr"`

+ 6 - 8
xmlSharedStrings.go

@@ -3,8 +3,8 @@ package excelize
 import "encoding/xml"
 import "encoding/xml"
 
 
 // xlsxSST directly maps the sst element from the namespace
 // xlsxSST directly maps the sst element from the namespace
-// http://schemas.openxmlformats.org/spreadsheetml/2006/main currently
-// I have not checked this for completeness - it does as much as I need.
+// http://schemas.openxmlformats.org/spreadsheetml/2006/main currently I have
+// not checked this for completeness - it does as much as I need.
 type xlsxSST struct {
 type xlsxSST struct {
 	XMLName     xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main sst"`
 	XMLName     xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main sst"`
 	Count       int      `xml:"count,attr"`
 	Count       int      `xml:"count,attr"`
@@ -13,18 +13,16 @@ type xlsxSST struct {
 }
 }
 
 
 // xlsxSI directly maps the si element from the namespace
 // xlsxSI directly maps the si element from the namespace
-// http://schemas.openxmlformats.org/spreadsheetml/2006/main -
-// currently I have not checked this for completeness - it does as
-// much as I need.
+// http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have
+// not checked this for completeness - it does as much as I need.
 type xlsxSI struct {
 type xlsxSI struct {
 	T string  `xml:"t"`
 	T string  `xml:"t"`
 	R []xlsxR `xml:"r"`
 	R []xlsxR `xml:"r"`
 }
 }
 
 
 // xlsxR directly maps the r element from the namespace
 // xlsxR directly maps the r element from the namespace
-// http://schemas.openxmlformats.org/spreadsheetml/2006/main -
-// currently I have not checked this for completeness - it does as
-// much as I need.
+// http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have
+// not checked this for completeness - it does as much as I need.
 type xlsxR struct {
 type xlsxR struct {
 	T string `xml:"t"`
 	T string `xml:"t"`
 }
 }

+ 56 - 64
xmlWorkbook.go

@@ -10,8 +10,7 @@ const (
 	sheetStateVeryHidden = `veryHidden`
 	sheetStateVeryHidden = `veryHidden`
 )
 )
 
 
-// xmlxWorkbookRels contains xmlxWorkbookRelations
-// which maps sheet id and sheet XML.
+// xmlxWorkbookRels contains xmlxWorkbookRelations which maps sheet id and sheet XML.
 type xlsxWorkbookRels struct {
 type xlsxWorkbookRels struct {
 	XMLName       xml.Name               `xml:"http://schemas.openxmlformats.org/package/2006/relationships Relationships"`
 	XMLName       xml.Name               `xml:"http://schemas.openxmlformats.org/package/2006/relationships Relationships"`
 	Relationships []xlsxWorkbookRelation `xml:"Relationship"`
 	Relationships []xlsxWorkbookRelation `xml:"Relationship"`
@@ -25,9 +24,8 @@ type xlsxWorkbookRelation struct {
 }
 }
 
 
 // xlsxWorkbook directly maps the workbook element from the namespace
 // xlsxWorkbook directly maps the workbook element from 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 xlsxWorkbook struct {
 type xlsxWorkbook struct {
 	XMLName            xml.Name                `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main workbook"`
 	XMLName            xml.Name                `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main workbook"`
 	FileVersion        *xlsxFileVersion        `xml:"fileVersion"`
 	FileVersion        *xlsxFileVersion        `xml:"fileVersion"`
@@ -43,10 +41,10 @@ type xlsxWorkbook struct {
 	FileRecoveryPr     *xlsxFileRecoveryPr     `xml:"fileRecoveryPr"`
 	FileRecoveryPr     *xlsxFileRecoveryPr     `xml:"fileRecoveryPr"`
 }
 }
 
 
-// xlsxFileRecoveryPr maps sheet recovery information. This element
-// defines properties that track the state of the workbook file, such
-// as whether the file was saved during a crash, or whether it should
-// be opened in auto-recover mode.
+// xlsxFileRecoveryPr maps sheet recovery information. This element defines
+// properties that track the state of the workbook file, such as whether the
+// file was saved during a crash, or whether it should be opened in auto-recover
+// mode.
 type xlsxFileRecoveryPr struct {
 type xlsxFileRecoveryPr struct {
 	AutoRecover     bool `xml:"autoRecover,attr,omitempty"`
 	AutoRecover     bool `xml:"autoRecover,attr,omitempty"`
 	CrashSave       bool `xml:"crashSave,attr,omitempty"`
 	CrashSave       bool `xml:"crashSave,attr,omitempty"`
@@ -54,16 +52,15 @@ type xlsxFileRecoveryPr struct {
 	RepairLoad      bool `xml:"repairLoad,attr,omitempty"`
 	RepairLoad      bool `xml:"repairLoad,attr,omitempty"`
 }
 }
 
 
-// xlsxWorkbookProtection directly maps the workbookProtection element.
-// This element specifies options for protecting data in the workbook.
-// Applications might use workbook protection to prevent anyone from
-// accidentally changing, moving, or deleting important data. This
-// protection can be ignored by applications which choose not to support
-// this optional protection mechanism.
-// When a password is to be hashed and stored in this element, it shall
-// be hashed as defined below, starting from a UTF-16LE encoded string
-// value. If there is a leading BOM character (U+FEFF) in the encoded
-// password it is removed before hash calculation.
+// xlsxWorkbookProtection directly maps the workbookProtection element. This
+// element specifies options for protecting data in the workbook. Applications
+// might use workbook protection to prevent anyone from accidentally changing,
+// moving, or deleting important data. This protection can be ignored by
+// applications which choose not to support this optional protection mechanism.
+// When a password is to be hashed and stored in this element, it shall be
+// hashed as defined below, starting from a UTF-16LE encoded string value. If
+// there is a leading BOM character (U+FEFF) in the encoded password it is
+// removed before hash calculation.
 type xlsxWorkbookProtection struct {
 type xlsxWorkbookProtection struct {
 	LockRevision           bool   `xml:"lockRevision,attr,omitempty"`
 	LockRevision           bool   `xml:"lockRevision,attr,omitempty"`
 	LockStructure          bool   `xml:"lockStructure,attr,omitempty"`
 	LockStructure          bool   `xml:"lockStructure,attr,omitempty"`
@@ -78,9 +75,9 @@ type xlsxWorkbookProtection struct {
 	WorkbookSpinCount      int    `xml:"workbookSpinCount,attr,omitempty"`
 	WorkbookSpinCount      int    `xml:"workbookSpinCount,attr,omitempty"`
 }
 }
 
 
-// xlsxFileVersion directly maps the fileVersion element. This element
-// defines properties that track which version of the application accessed
-// the data and source code contained in the file.
+// xlsxFileVersion directly maps the fileVersion element. This element defines
+// properties that track which version of the application accessed the data and
+// source code contained in the file.
 type xlsxFileVersion struct {
 type xlsxFileVersion struct {
 	AppName      string `xml:"appName,attr,omitempty"`
 	AppName      string `xml:"appName,attr,omitempty"`
 	CodeName     string `xml:"codeName,attr,omitempty"`
 	CodeName     string `xml:"codeName,attr,omitempty"`
@@ -89,9 +86,9 @@ type xlsxFileVersion struct {
 	RupBuild     string `xml:"rupBuild,attr,omitempty"`
 	RupBuild     string `xml:"rupBuild,attr,omitempty"`
 }
 }
 
 
-// xlsxWorkbookPr directly maps the workbookPr element from the
-// namespace http://schemas.openxmlformats.org/spreadsheetml/2006/main
-// This element defines a collection of workbook properties.
+// xlsxWorkbookPr directly maps the workbookPr element from the namespace
+// http://schemas.openxmlformats.org/spreadsheetml/2006/main This element
+// defines a collection of workbook properties.
 type xlsxWorkbookPr struct {
 type xlsxWorkbookPr struct {
 	AllowRefreshQuery          bool   `xml:"allowRefreshQuery,attr,omitempty"`
 	AllowRefreshQuery          bool   `xml:"allowRefreshQuery,attr,omitempty"`
 	AutoCompressPictures       bool   `xml:"autoCompressPictures,attr,omitempty"`
 	AutoCompressPictures       bool   `xml:"autoCompressPictures,attr,omitempty"`
@@ -113,17 +110,17 @@ type xlsxWorkbookPr struct {
 	UpdateLinks                string `xml:"updateLinks,attr,omitempty"`
 	UpdateLinks                string `xml:"updateLinks,attr,omitempty"`
 }
 }
 
 
-// xlsxBookViews directly maps the bookViews element. This element specifies
-// the collection of workbook views of the enclosing workbook. Each view can
-// specify a window position, filter options, and other configurations. There
-// is no limit on the number of workbook views that can be defined for a workbook.
+// xlsxBookViews directly maps the bookViews element. This element specifies the
+// collection of workbook views of the enclosing workbook. Each view can specify
+// a window position, filter options, and other configurations. There is no
+// limit on the number of workbook views that can be defined for a workbook.
 type xlsxBookViews struct {
 type xlsxBookViews struct {
 	WorkBookView []xlsxWorkBookView `xml:"workbookView"`
 	WorkBookView []xlsxWorkBookView `xml:"workbookView"`
 }
 }
 
 
-// xlsxWorkBookView directly maps the workbookView element from the
-// namespace http://schemas.openxmlformats.org/spreadsheetml/2006/main
-// This element specifies a single Workbook view.
+// xlsxWorkBookView directly maps the workbookView element from the namespace
+// http://schemas.openxmlformats.org/spreadsheetml/2006/main This element
+// specifies a single Workbook view.
 type xlsxWorkBookView struct {
 type xlsxWorkBookView struct {
 	ActiveTab              int    `xml:"activeTab,attr,omitempty"`
 	ActiveTab              int    `xml:"activeTab,attr,omitempty"`
 	AutoFilterDateGrouping bool   `xml:"autoFilterDateGrouping,attr,omitempty"`
 	AutoFilterDateGrouping bool   `xml:"autoFilterDateGrouping,attr,omitempty"`
@@ -147,9 +144,8 @@ type xlsxSheets struct {
 }
 }
 
 
 // xlsxSheet directly maps the sheet element from the namespace
 // xlsxSheet directly maps the sheet element from 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 xlsxSheet struct {
 type xlsxSheet struct {
 	Name    string `xml:"name,attr,omitempty"`
 	Name    string `xml:"name,attr,omitempty"`
 	SheetID string `xml:"sheetId,attr,omitempty"`
 	SheetID string `xml:"sheetId,attr,omitempty"`
@@ -157,20 +153,20 @@ type xlsxSheet struct {
 	State   string `xml:"state,attr,omitempty"`
 	State   string `xml:"state,attr,omitempty"`
 }
 }
 
 
-// xlsxExternalReferences directly maps the externalReferences element
-// of the external workbook references part.
+// xlsxExternalReferences directly maps the externalReferences element of the
+// external workbook references part.
 type xlsxExternalReferences struct {
 type xlsxExternalReferences struct {
 	ExternalReference []xlsxExternalReference `xml:"externalReference"`
 	ExternalReference []xlsxExternalReference `xml:"externalReference"`
 }
 }
 
 
-// xlsxExternalReference directly maps the externalReference element
-// of the external workbook references part.
+// xlsxExternalReference directly maps the externalReference element of the
+// external workbook references part.
 type xlsxExternalReference struct {
 type xlsxExternalReference struct {
 	RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
 	RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
 }
 }
 
 
-// xlsxPivotCaches element enumerates pivot cache definition parts
-// used by pivot tables and formulas in this workbook.
+// xlsxPivotCaches element enumerates pivot cache definition parts used by pivot
+// tables and formulas in this workbook.
 type xlsxPivotCaches struct {
 type xlsxPivotCaches struct {
 	PivotCache []xlsxPivotCache `xml:"pivotCache"`
 	PivotCache []xlsxPivotCache `xml:"pivotCache"`
 }
 }
@@ -182,33 +178,30 @@ type xlsxPivotCache struct {
 }
 }
 
 
 // extLst element provides a convention for extending spreadsheetML in
 // extLst element provides a convention for extending spreadsheetML in
-// predefined locations. The locations shall be denoted with the extLst
-// element, and are called extension lists. Extension list locations
-// within the markup document are specified in the markup specification
-// and can be used to store extensions to the markup specification,
-// whether those are future version extensions of the markup specification
-// or are private extensions implemented independently from the markup
-// specification. Markup within an extension might not be understood by a
-// consumer.
+// predefined locations. The locations shall be denoted with the extLst element,
+// and are called extension lists. Extension list locations within the markup
+// document are specified in the markup specification and can be used to store
+// extensions to the markup specification, whether those are future version
+// extensions of the markup specification or are private extensions implemented
+// independently from the markup specification. Markup within an extension might
+// not be understood by a consumer.
 type xlsxExtLst struct {
 type xlsxExtLst struct {
 	Ext string `xml:",innerxml"`
 	Ext string `xml:",innerxml"`
 }
 }
 
 
-// xlsxDefinedNames directly maps the definedNames element. This element
-// defines the collection of defined names for this workbook. Defined
-// names are descriptive names to represent cells, ranges of cells,
-// formulas, or constant values. Defined names can be used to represent
-// a range on any worksheet.
+// xlsxDefinedNames directly maps the definedNames element. This element defines
+// the collection of defined names for this workbook. Defined names are
+// descriptive names to represent cells, ranges of cells, formulas, or constant
+// values. Defined names can be used to represent a range on any worksheet.
 type xlsxDefinedNames struct {
 type xlsxDefinedNames struct {
 	DefinedName []xlsxDefinedName `xml:"definedName"`
 	DefinedName []xlsxDefinedName `xml:"definedName"`
 }
 }
 
 
-// xlsxDefinedName directly maps the definedName element from the
-// namespace http://schemas.openxmlformats.org/spreadsheetml/2006/main
-// This element defines a defined name within this workbook. A defined
-// name is descriptive text that is used to represents a cell, range of
-// cells, formula, or constant value. For a descriptions of the attributes
-// see https://msdn.microsoft.com/en-us/library/office/documentformat.openxml.spreadsheet.definedname.aspx
+// xlsxDefinedName directly maps the definedName element from the namespace
+// http://schemas.openxmlformats.org/spreadsheetml/2006/main This element
+// defines a defined name within this workbook. A defined name is descriptive
+// text that is used to represents a cell, range of cells, formula, or constant
+// value. For a descriptions of the attributes see https://msdn.microsoft.com/en-us/library/office/documentformat.openxml.spreadsheet.definedname.aspx
 type xlsxDefinedName struct {
 type xlsxDefinedName struct {
 	Comment           string `xml:"comment,attr,omitempty"`
 	Comment           string `xml:"comment,attr,omitempty"`
 	CustomMenu        string `xml:"customMenu,attr,omitempty"`
 	CustomMenu        string `xml:"customMenu,attr,omitempty"`
@@ -229,10 +222,9 @@ type xlsxDefinedName struct {
 }
 }
 
 
 // xlsxCalcPr directly maps the calcPr element. This element defines the
 // xlsxCalcPr directly maps the calcPr element. This element defines the
-// collection of properties the application uses to record calculation
-// status and details. Calculation is the process of computing formulas
-// and then displaying the results as values in the cells that contain
-// the formulas.
+// collection of properties the application uses to record calculation status
+// and details. Calculation is the process of computing formulas and then
+// displaying the results as values in the cells that contain the formulas.
 type xlsxCalcPr struct {
 type xlsxCalcPr struct {
 	CalcCompleted         bool    `xml:"calcCompleted,attr,omitempty"`
 	CalcCompleted         bool    `xml:"calcCompleted,attr,omitempty"`
 	CalcID                string  `xml:"calcId,attr,omitempty"`
 	CalcID                string  `xml:"calcId,attr,omitempty"`

+ 101 - 120
xmlWorksheet.go

@@ -3,9 +3,8 @@ package excelize
 import "encoding/xml"
 import "encoding/xml"
 
 
 // xlsxWorksheet directly maps the worksheet element in the namespace
 // 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 {
 type xlsxWorksheet struct {
 	XMLName               xml.Name                   `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main worksheet"`
 	XMLName               xml.Name                   `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main worksheet"`
 	SheetPr               *xlsxSheetPr               `xml:"sheetPr"`
 	SheetPr               *xlsxSheetPr               `xml:"sheetPr"`
@@ -35,13 +34,12 @@ type xlsxDrawing struct {
 }
 }
 
 
 // xlsxHeaderFooter directly maps the headerFooter element in the namespace
 // 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 {
 type xlsxHeaderFooter struct {
 	DifferentFirst   bool             `xml:"differentFirst,attr,omitempty"`
 	DifferentFirst   bool             `xml:"differentFirst,attr,omitempty"`
 	DifferentOddEven bool             `xml:"differentOddEven,attr,omitempty"`
 	DifferentOddEven bool             `xml:"differentOddEven,attr,omitempty"`
@@ -50,24 +48,22 @@ type xlsxHeaderFooter struct {
 }
 }
 
 
 // xlsxOddHeader directly maps the oddHeader element in the namespace
 // 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 {
 type xlsxOddHeader struct {
 	Content string `xml:",chardata"`
 	Content string `xml:",chardata"`
 }
 }
 
 
 // xlsxOddFooter directly maps the oddFooter element in the namespace
 // 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 {
 type xlsxOddFooter struct {
 	Content string `xml:",chardata"`
 	Content string `xml:",chardata"`
 }
 }
 
 
 // xlsxPageSetUp directly maps the pageSetup element in the namespace
 // 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 {
 type xlsxPageSetUp struct {
 	BlackAndWhite      bool    `xml:"blackAndWhite,attr,omitempty"`
 	BlackAndWhite      bool    `xml:"blackAndWhite,attr,omitempty"`
 	CellComments       string  `xml:"cellComments,attr,omitempty"`
 	CellComments       string  `xml:"cellComments,attr,omitempty"`
@@ -91,9 +87,9 @@ type xlsxPageSetUp struct {
 }
 }
 
 
 // xlsxPrintOptions directly maps the printOptions element in the namespace
 // 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 {
 type xlsxPrintOptions struct {
 	GridLines          bool `xml:"gridLines,attr,omitempty"`
 	GridLines          bool `xml:"gridLines,attr,omitempty"`
 	GridLinesSet       bool `xml:"gridLinesSet,attr,omitempty"`
 	GridLinesSet       bool `xml:"gridLinesSet,attr,omitempty"`
@@ -103,8 +99,8 @@ type xlsxPrintOptions struct {
 }
 }
 
 
 // xlsxPageMargins directly maps the pageMargins element in the namespace
 // 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 {
 type xlsxPageMargins struct {
 	Bottom float64 `xml:"bottom,attr"`
 	Bottom float64 `xml:"bottom,attr"`
 	Footer float64 `xml:"footer,attr"`
 	Footer float64 `xml:"footer,attr"`
@@ -115,9 +111,8 @@ type xlsxPageMargins struct {
 }
 }
 
 
 // xlsxSheetFormatPr directly maps the sheetFormatPr element in the namespace
 // 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 {
 type xlsxSheetFormatPr struct {
 	DefaultColWidth  float64 `xml:"defaultColWidth,attr,omitempty"`
 	DefaultColWidth  float64 `xml:"defaultColWidth,attr,omitempty"`
 	DefaultRowHeight float64 `xml:"defaultRowHeight,attr"`
 	DefaultRowHeight float64 `xml:"defaultRowHeight,attr"`
@@ -128,24 +123,21 @@ type xlsxSheetFormatPr struct {
 }
 }
 
 
 // xlsxSheetViews directly maps the sheetViews element in the namespace
 // 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 {
 type xlsxSheetViews struct {
 	SheetView []xlsxSheetView `xml:"sheetView"`
 	SheetView []xlsxSheetView `xml:"sheetView"`
 }
 }
 
 
 // xlsxSheetView directly maps the sheetView element in the namespace
 // 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.
 // (with corresponding workbookView entries) are saved.
 type xlsxSheetView struct {
 type xlsxSheetView struct {
 	WindowProtection        bool             `xml:"windowProtection,attr,omitempty"`
 	WindowProtection        bool             `xml:"windowProtection,attr,omitempty"`
@@ -169,8 +161,8 @@ type xlsxSheetView struct {
 }
 }
 
 
 // xlsxSelection directly maps the selection element in the namespace
 // 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 {
 type xlsxSelection struct {
 	ActiveCell   string `xml:"activeCell,attr,omitempty"`
 	ActiveCell   string `xml:"activeCell,attr,omitempty"`
 	ActiveCellID int    `xml:"activeCellId,attr"`
 	ActiveCellID int    `xml:"activeCellId,attr"`
@@ -178,8 +170,7 @@ type xlsxSelection struct {
 	SQRef        string `xml:"sqref,attr,omitempty"`
 	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 {
 type xlsxPane struct {
 	ActivePane  string  `xml:"activePane,attr,omitempty"`
 	ActivePane  string  `xml:"activePane,attr,omitempty"`
 	State       string  `xml:"state,attr,omitempty"` // Either "split" or "frozen"
 	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
 // 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 {
 type xlsxSheetPr struct {
 	XMLName                           xml.Name         `xml:"sheetPr"`
 	XMLName                           xml.Name         `xml:"sheetPr"`
 	CodeName                          string           `xml:"codeName,attr,omitempty"`
 	CodeName                          string           `xml:"codeName,attr,omitempty"`
@@ -205,25 +196,23 @@ type xlsxSheetPr struct {
 }
 }
 
 
 // xlsxPageSetUpPr directly maps the pageSetupPr element in the namespace
 // 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 {
 type xlsxPageSetUpPr struct {
 	AutoPageBreaks bool `xml:"autoPageBreaks,attr,omitempty"`
 	AutoPageBreaks bool `xml:"autoPageBreaks,attr,omitempty"`
 	FitToPage      bool `xml:"fitToPage,attr,omitempty"` // Flag indicating whether the Fit to Page print option is enabled.
 	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 {
 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
 // 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 {
 type xlsxCols struct {
 	Col []xlsxCol `xml:"col"`
 	Col []xlsxCol `xml:"col"`
 }
 }
@@ -244,28 +233,27 @@ type xlsxCol struct {
 }
 }
 
 
 // xlsxDimension directly maps the dimension element in the namespace
 // 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 {
 type xlsxDimension struct {
 	Ref string `xml:"ref,attr"`
 	Ref string `xml:"ref,attr"`
 }
 }
 
 
 // xlsxSheetData directly maps the sheetData element in the namespace
 // 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 {
 type xlsxSheetData struct {
 	XMLName xml.Name  `xml:"sheetData"`
 	XMLName xml.Name  `xml:"sheetData"`
 	Row     []xlsxRow `xml:"row"`
 	Row     []xlsxRow `xml:"row"`
 }
 }
 
 
 // xlsxRow directly maps the row element. The element expresses information
 // 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 {
 type xlsxRow struct {
 	Collapsed    bool    `xml:"collapsed,attr,omitempty"`
 	Collapsed    bool    `xml:"collapsed,attr,omitempty"`
 	CustomFormat bool    `xml:"customFormat,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.
 // xlsxMergeCell directly maps the mergeCell element. A single merged cell.
 type xlsxMergeCell struct {
 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 {
 type xlsxMergeCells struct {
 	Count int              `xml:"count,attr,omitempty"`
 	Count int              `xml:"count,attr,omitempty"`
 	Cells []*xlsxMergeCell `xml:"mergeCell,omitempty"`
 	Cells []*xlsxMergeCell `xml:"mergeCell,omitempty"`
 }
 }
 
 
 // xlsxC directly maps the c element in the namespace
 // 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 {
 type xlsxC struct {
 	R string `xml:"r,attr"`           // Cell ID, e.g. A1
 	R string `xml:"r,attr"`           // Cell ID, e.g. A1
 	S int    `xml:"s,attr,omitempty"` // Style reference.
 	S int    `xml:"s,attr,omitempty"` // Style reference.
@@ -308,9 +295,8 @@ type xlsxC struct {
 }
 }
 
 
 // xlsxF directly maps the f element in the namespace
 // 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 {
 type xlsxF struct {
 	Content string `xml:",chardata"`
 	Content string `xml:",chardata"`
 	T       string `xml:"t,attr,omitempty"`   // Formula type
 	T       string `xml:"t,attr,omitempty"`   // Formula type
@@ -318,8 +304,8 @@ type xlsxF struct {
 	Si      string `xml:"si,attr,omitempty"`  // Shared formula index
 	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 {
 type xlsxSheetProtection struct {
 	AlgorithmName      string `xml:"algorithmName,attr,omitempty"`
 	AlgorithmName      string `xml:"algorithmName,attr,omitempty"`
 	AutoFilter         int    `xml:"autoFilter,attr,omitempty"`
 	AutoFilter         int    `xml:"autoFilter,attr,omitempty"`
@@ -343,19 +329,18 @@ type xlsxSheetProtection struct {
 	SpinCount          int    `xml:"spinCount,attr,omitempty"`
 	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 {
 type xlsxConditionalFormatting struct {
 	CfRule string `xml:",innerxml"`
 	CfRule string `xml:",innerxml"`
 }
 }
 
 
 // xlsxHyperlinks directly maps the hyperlinks element in the namespace
 // 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 {
 type xlsxHyperlinks struct {
 	Hyperlink []xlsxHyperlink `xml:"hyperlink"`
 	Hyperlink []xlsxHyperlink `xml:"hyperlink"`
 }
 }
@@ -370,31 +355,28 @@ type xlsxHyperlink struct {
 }
 }
 
 
 // xlsxTableParts directly maps the tableParts element in the namespace
 // 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.
 // names.
 // To add columns to your table you add new tableColumn elements to the
 // 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">
 //    <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
 // 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"/>
 //    <picture r:id="rId1"/>
 //
 //
 type xlsxPicture struct {
 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
 // 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 {
 type xlsxLegacyDrawing struct {
 	RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
 	RID string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/relationships id,attr,omitempty"`
 }
 }