Browse Source

Merge pull request #44 from bronze1man/pr-gofmt

gofmt -w -s .
Geoffrey J. Teale 11 years ago
parent
commit
b16a08b522
16 changed files with 90 additions and 122 deletions
  1. 4 10
      cell_test.go
  2. 3 3
      contenttypes.go
  3. 0 1
      contenttypes_test.go
  4. 7 11
      file.go
  5. 7 15
      file_test.go
  6. 24 24
      lib.go
  7. 8 12
      lib_test.go
  8. 2 2
      row_test.go
  9. 3 6
      sharedstrings.go
  10. 0 2
      sharedstrings_test.go
  11. 3 3
      sheet.go
  12. 2 4
      sheet_test.go
  13. 0 1
      style.go
  14. 19 19
      workbook.go
  15. 1 2
      workbook_test.go
  16. 7 7
      worksheet.go

+ 4 - 10
cell_test.go

@@ -4,18 +4,16 @@ import (
 	. "gopkg.in/check.v1"
 )
 
-type StyleSuite struct {}
+type StyleSuite struct{}
 
 var _ = Suite(&StyleSuite{})
 
-
-func (s *StyleSuite) TestNewStyle(c *C){
+func (s *StyleSuite) TestNewStyle(c *C) {
 	style := NewStyle()
 	c.Assert(style, NotNil)
 }
 
-
-type FontSuite struct {}
+type FontSuite struct{}
 
 var _ = Suite(&FontSuite{})
 
@@ -26,7 +24,7 @@ func (s *FontSuite) TestNewFont(c *C) {
 	c.Assert(font.Size, Equals, 12)
 }
 
-type CellSuite struct {}
+type CellSuite struct{}
 
 var _ = Suite(&CellSuite{})
 
@@ -83,7 +81,6 @@ func (s *CellSuite) TestSetStyleWithFonts(c *C) {
 	c.Assert(xFont.Name.Val, Equals, "Calibra")
 }
 
-
 // Test that GetStyle correctly converts the xlsxStyle.Fills.
 func (s *CellSuite) TestGetStyleWithFills(c *C) {
 	var cell *Cell
@@ -130,7 +127,6 @@ func (s *CellSuite) TestSetStyleWithFills(c *C) {
 	c.Assert(xPatternFill.BgColor.RGB, Equals, "FF000000")
 }
 
-
 // Test that GetStyle correctly converts the xlsxStyle.Borders.
 func (s *CellSuite) TestGetStyleWithBorders(c *C) {
 	var cell *Cell
@@ -160,7 +156,6 @@ func (s *CellSuite) TestGetStyleWithBorders(c *C) {
 	c.Assert(border.Bottom, Equals, "thin")
 }
 
-
 func (s *CellSuite) TestGetNumberFormat(c *C) {
 	var cell *Cell
 	var cellXfs []xlsxXf
@@ -345,4 +340,3 @@ func (l *CellSuite) TestFormattedValue(c *C) {
 	c.Assert(cell.FormattedValue(), Equals, "2003-11-22 18:00:00")
 	c.Assert(smallCell.FormattedValue(), Equals, "1899-12-30 00:14:47")
 }
-

+ 3 - 3
contenttypes.go

@@ -8,7 +8,7 @@ type xlsxTypes struct {
 	XMLName xml.Name `xml:"http://schemas.openxmlformats.org/package/2006/content-types Types"`
 
 	Overrides []xlsxOverride `xml:"Override"`
-	Defaults []xlsxDefault `xml:"Default"`
+	Defaults  []xlsxDefault  `xml:"Default"`
 }
 
 type xlsxOverride struct {
@@ -17,8 +17,8 @@ type xlsxOverride struct {
 }
 
 type xlsxDefault struct {
-	Extension	string `xml:",attr"`
-	ContentType	string `xml:",attr"`
+	Extension   string `xml:",attr"`
+	ContentType string `xml:",attr"`
 }
 
 func MakeDefaultContentTypes() (types xlsxTypes) {

+ 0 - 1
contenttypes_test.go

@@ -46,5 +46,4 @@ func (l *ContentTypesSuite) TestMakeDefaultContentTypes(c *C) {
 	c.Assert(types.Defaults[1].Extension, Equals, "xml")
 	c.Assert(types.Defaults[1].ContentType, Equals, "application/xml")
 
-
 }

+ 7 - 11
file.go

@@ -17,14 +17,13 @@ type File struct {
 	referenceTable *RefTable
 	Date1904       bool
 	styles         *xlsxStyles
-	Sheets       []*Sheet
-	Sheet        map[string]*Sheet
+	Sheets         []*Sheet
+	Sheet          map[string]*Sheet
 }
 
-
 // Create a new File
 func NewFile() (file *File) {
-	file = &File{};
+	file = &File{}
 	file.Sheet = make(map[string]*Sheet)
 	file.Sheets = make([]*Sheet, 0)
 	return
@@ -78,7 +77,6 @@ func (f *File) Save(path string) (err error) {
 	return target.Close()
 }
 
-
 // Add a new Sheet, with the provided name, to a File
 func (f *File) AddSheet(sheetName string) (sheet *Sheet) {
 	sheet = &Sheet{Name: sheetName}
@@ -101,7 +99,6 @@ func (f *File) makeWorkbook() xlsxWorkbook {
 	return workbook
 }
 
-
 // Construct a map of file name to XML content representing the file
 // in terms of the structure of an XLSX file.
 func (f *File) MarshallParts() (map[string]string, error) {
@@ -120,7 +117,6 @@ func (f *File) MarshallParts() (map[string]string, error) {
 		return xml.Header + string(body), nil
 	}
 
-
 	parts = make(map[string]string)
 	workbook = f.makeWorkbook()
 	sheetIndex := 1
@@ -134,13 +130,13 @@ func (f *File) MarshallParts() (map[string]string, error) {
 		types.Overrides = append(
 			types.Overrides,
 			xlsxOverride{
-				PartName: partName,
+				PartName:    partName,
 				ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"})
 		workbookRels[rId] = sheetPath
-		workbook.Sheets.Sheet[sheetIndex - 1] = xlsxSheet{
-			Name: sheet.Name,
+		workbook.Sheets.Sheet[sheetIndex-1] = xlsxSheet{
+			Name:    sheet.Name,
 			SheetId: sheetId,
-			Id: rId}
+			Id:      rId}
 		parts[partName], err = marshal(xSheet)
 		if err != nil {
 			return parts, err

+ 7 - 15
file_test.go

@@ -2,11 +2,11 @@ package xlsx
 
 import (
 	"encoding/xml"
-	"path/filepath"
 	. "gopkg.in/check.v1"
+	"path/filepath"
 )
 
-type FileSuite struct {}
+type FileSuite struct{}
 
 var _ = Suite(&FileSuite{})
 
@@ -21,7 +21,6 @@ func (l *FileSuite) TestOpenFile(c *C) {
 	c.Assert(xlsxFile, NotNil)
 }
 
-
 func (l *FileSuite) TestOpenFileWithoutStyleAndSharedStrings(c *C) {
 	var xlsxFile *File
 	var error error
@@ -42,7 +41,6 @@ func (l *FileSuite) TestReadSharedStringsFromZipFile(c *C) {
 	c.Assert(xlsxFile.referenceTable, NotNil)
 }
 
-
 // Helper function used to test contents of a given xlsxXf against
 // expectations.
 func testXf(c *C, result, expected *xlsxXf) {
@@ -160,20 +158,17 @@ func (l *FileSuite) TestGetStyleFromZipFile(c *C) {
 	c.Assert(cellFoo.String(), Equals, "Foo")
 	c.Assert(style.Fill.BgColor, Equals, "FF33CCCC")
 
-
 	row1 := tabelle1.Rows[1]
 	cellQuuk := row1.Cells[1]
 	style = cellQuuk.GetStyle()
 	c.Assert(cellQuuk.String(), Equals, "Quuk")
 	c.Assert(style.Border.Left, Equals, "thin")
 
-
 	cellBar := row0.Cells[1]
 	c.Assert(cellBar.String(), Equals, "Bar")
 	c.Assert(cellBar.GetStyle().Fill.BgColor, Equals, "")
 }
 
-
 // Test we can create a File object from scratch
 func (l *FileSuite) TestCreateFile(c *C) {
 	var xlsxFile *File
@@ -229,7 +224,7 @@ func (l *FileSuite) TestNthSheet(c *C) {
 	c.Assert(sheetByIndex, Equals, sheetByName)
 }
 
-// Test that we can create a Workbook and marshal it to XML. 
+// Test that we can create a Workbook and marshal it to XML.
 func (l *FileSuite) TestMarshalWorkbook(c *C) {
 	var f *File
 
@@ -239,14 +234,14 @@ func (l *FileSuite) TestMarshalWorkbook(c *C) {
 	f.AddSheet("MySecondSheet")
 	workbook := f.makeWorkbook()
 	workbook.Sheets.Sheet[0] = xlsxSheet{
-		Name: "MyFirstSheet",
+		Name:    "MyFirstSheet",
 		SheetId: "1",
-		Id: "rId1"}
+		Id:      "rId1"}
 
 	workbook.Sheets.Sheet[1] = xlsxSheet{
-		Name: "MySecondSheet",
+		Name:    "MySecondSheet",
 		SheetId: "2",
-		Id: "rId2"}
+		Id:      "rId2"}
 
 	expectedWorkbook := `<?xml version="1.0" encoding="UTF-8"?>
    <workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
@@ -268,7 +263,6 @@ func (l *FileSuite) TestMarshalWorkbook(c *C) {
 	c.Assert(stringOutput, Equals, expectedWorkbook)
 }
 
-
 // Test that we can marshall a File to a collection of xml files
 func (l *FileSuite) TestMarshalFile(c *C) {
 	var f *File
@@ -375,7 +369,6 @@ func (l *FileSuite) TestMarshalFile(c *C) {
   </Types>`
 	c.Assert(parts["[Content_Types].xml"], Equals, expectedContentTypes)
 
-
 	// styles.xml
 	//
 	// For now we only allow simple string data in the
@@ -386,7 +379,6 @@ func (l *FileSuite) TestMarshalFile(c *C) {
 	c.Assert(parts["xl/styles.xml"], Equals, expectedStyles)
 }
 
-
 // We can save a File as a valid XLSX file at a given path.
 func (l *FileSuite) TestSaveFile(c *C) {
 	var tmpPath string = c.MkDir()

+ 24 - 24
lib.go

@@ -65,15 +65,14 @@ func lettersToNumeric(letters string) int {
 	return sum
 }
 
-
 // Get the largestDenominator that is a multiple of a basedDenominator
 // and fits at least once into a given numerator.
 func getLargestDenominator(numerator, multiple, baseDenominator, power int) (int, int) {
-	if numerator / multiple == 0 {
+	if numerator/multiple == 0 {
 		return 1, power
 	}
 	next, nextPower := getLargestDenominator(
-		numerator, multiple * baseDenominator, baseDenominator, power + 1)
+		numerator, multiple*baseDenominator, baseDenominator, power+1)
 	if next > multiple {
 		return next, nextPower
 	}
@@ -86,7 +85,7 @@ func formatColumnName(colId []int) string {
 	lastPart := len(colId) - 1
 
 	result := ""
-	for n, part := range(colId) {
+	for n, part := range colId {
 		if n == lastPart {
 			// The least significant number is in the
 			// range 0-25, all other numbers are 1-26,
@@ -182,7 +181,7 @@ func getCoordsFromCellIDString(cellIDString string) (x, y int, error error) {
 // getCellIDStringFromCoords returns the Excel format cell name that
 // represents a pair of zero based cartesian coordinates.
 func getCellIDStringFromCoords(x, y int) string {
-	letterPart := numericToLetters(x);
+	letterPart := numericToLetters(x)
 	numericPart := y + 1
 	return fmt.Sprintf("%s%d", letterPart, numericPart)
 }
@@ -245,8 +244,12 @@ func calculateMaxMinFromWorksheet(worksheet *xlsxWorksheet) (minx, miny, maxx, m
 			}
 		}
 	}
-	if minx == maxVal { minx = 0 }
-	if miny == maxVal { miny = 0 }
+	if minx == maxVal {
+		minx = 0
+	}
+	if miny == maxVal {
+		miny = 0
+	}
 	return
 }
 
@@ -468,7 +471,6 @@ func readSharedStringsFromZipFile(f *zip.File) (*RefTable, error) {
 	var decoder *xml.Decoder
 	var reftable *RefTable
 
-
 	// In a file with no strings it's possible that
 	// sharedStrings.xml doesn't exist.  In this case the value
 	// passed as f will be nil.
@@ -523,36 +525,35 @@ type WorkBookRels map[string]string
 func (w *WorkBookRels) MakeXLSXWorkbookRels() xlsxWorkbookRels {
 	relCount := len(*w)
 	xWorkbookRels := xlsxWorkbookRels{}
-	xWorkbookRels.Relationships = make([]xlsxWorkbookRelation, relCount + 2)
-	for k, v := range(*w) {
-		index, err := strconv.Atoi(k[3:len(k)])
+	xWorkbookRels.Relationships = make([]xlsxWorkbookRelation, relCount+2)
+	for k, v := range *w {
+		index, err := strconv.Atoi(k[3:])
 		if err != nil {
 			panic(err.Error())
 		}
-		xWorkbookRels.Relationships[index -1] = xlsxWorkbookRelation{
-			Id: k,
+		xWorkbookRels.Relationships[index-1] = xlsxWorkbookRelation{
+			Id:     k,
 			Target: v,
-			Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"}
+			Type:   "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"}
 	}
 
 	relCount++
 	sheetId := fmt.Sprintf("rId%d", relCount)
-	xWorkbookRels.Relationships[relCount -1] = xlsxWorkbookRelation{
-			Id: sheetId,
-			Target: "sharedStrings.xml",
-			Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"}
+	xWorkbookRels.Relationships[relCount-1] = xlsxWorkbookRelation{
+		Id:     sheetId,
+		Target: "sharedStrings.xml",
+		Type:   "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"}
 
 	relCount++
 	sheetId = fmt.Sprintf("rId%d", relCount)
-	xWorkbookRels.Relationships[relCount -1] = xlsxWorkbookRelation{
-			Id: sheetId,
-			Target: "styles.xml",
-		Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"}
+	xWorkbookRels.Relationships[relCount-1] = xlsxWorkbookRelation{
+		Id:     sheetId,
+		Target: "styles.xml",
+		Type:   "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"}
 
 	return xWorkbookRels
 }
 
-
 // readWorkbookRelationsFromZipFile is an internal helper function to
 // extract a map of relationship ID strings to the name of the
 // worksheet.xml file they refer to.  The resulting map can be used to
@@ -584,7 +585,6 @@ func readWorkbookRelationsFromZipFile(workbookRels *zip.File) (WorkBookRels, err
 	return sheetXMLMap, nil
 }
 
-
 // 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.

+ 8 - 12
lib_test.go

@@ -12,7 +12,6 @@ type LibSuite struct{}
 
 var _ = Suite(&LibSuite{})
 
-
 // which they are contained from the XLSX file, even when the
 // worksheet files have arbitrary, non-numeric names.
 func (l *LibSuite) TestReadWorkbookRelationsFromZipFileWithFunnyNames(c *C) {
@@ -27,7 +26,6 @@ func (l *LibSuite) TestReadWorkbookRelationsFromZipFileWithFunnyNames(c *C) {
 	c.Assert(cell1.String(), Equals, "I am Bob")
 }
 
-
 // We can marshal WorkBookRels to an xml file
 func (l *LibSuite) TestWorkBookRelsMarshal(c *C) {
 	var rels WorkBookRels = make(WorkBookRels)
@@ -49,7 +47,6 @@ func (l *LibSuite) TestWorkBookRelsMarshal(c *C) {
 	c.Assert(output.String(), Equals, expectedXML)
 }
 
-
 // Excel column codes are a special form of base26 that doesn't allow
 // zeros, except in the least significant part of the code.  Test we
 // can smoosh the numbers in a normal base26 representation (presented
@@ -71,7 +68,6 @@ func (l *LibSuite) TestFormatColumnName(c *C) {
 	c.Assert(formatColumnName([]int{26, 26, 25}), Equals, "ZZZ")
 }
 
-
 // getLargestDenominator returns the largest power of a provided value
 // that can fit within a given value.
 func (l *LibSuite) TestGetLargestDenominator(c *C) {
@@ -93,10 +89,10 @@ func (l *LibSuite) TestGetLargestDenominator(c *C) {
 	d, p = getLargestDenominator(9, 1, 2, 0)
 	c.Assert(d, Equals, 8)
 	c.Assert(p, Equals, 3)
-	d, p = getLargestDenominator(15,1, 2, 0)
+	d, p = getLargestDenominator(15, 1, 2, 0)
 	c.Assert(d, Equals, 8)
 	c.Assert(p, Equals, 3)
-	d, p = getLargestDenominator(16,1, 2, 0)
+	d, p = getLargestDenominator(16, 1, 2, 0)
 	c.Assert(d, Equals, 16)
 	c.Assert(p, Equals, 4)
 }
@@ -113,14 +109,14 @@ func (l *LibSuite) TestLettersToNumeric(c *C) {
 
 func (l *LibSuite) TestNumericToLetters(c *C) {
 	cases := map[string]int{
-		"A": 0,
-		"G": 6,
-		"Z": 25,
+		"A":  0,
+		"G":  6,
+		"Z":  25,
 		"AA": 26,
 		"AZ": 51,
 		"BA": 52,
-		"BZ": 77, "ZA": 26*26, "ZB": 26*26 + 1,
-		"ZZ": 26*26 + 25,
+		"BZ": 77, "ZA": 26 * 26, "ZB": 26*26 + 1,
+		"ZZ":  26*26 + 25,
 		"AAA": 26*26 + 26 + 0, "AMI": 1022}
 	for ans, input := range cases {
 		output := numericToLetters(input)
@@ -154,7 +150,7 @@ func (l *LibSuite) TestGetCoordsFromCellIDString(c *C) {
 	c.Assert(y, Equals, 2)
 }
 
-func (l *LibSuite) TestGetCellIDStringFromCoords(c *C){
+func (l *LibSuite) TestGetCellIDStringFromCoords(c *C) {
 	c.Assert(getCellIDStringFromCoords(0, 0), Equals, "A1")
 	c.Assert(getCellIDStringFromCoords(2, 2), Equals, "C3")
 }

+ 2 - 2
row_test.go

@@ -4,12 +4,12 @@ import (
 	. "gopkg.in/check.v1"
 )
 
-type RowSuite struct {}
+type RowSuite struct{}
 
 var _ = Suite(&RowSuite{})
 
 // Test we can add a new Cell to a Row
-func (r *RowSuite) TestAddCell(c *C){
+func (r *RowSuite) TestAddCell(c *C) {
 	var f *File
 	f = NewFile()
 	sheet := f.AddSheet("MySheet")

+ 3 - 6
sharedstrings.go

@@ -4,14 +4,13 @@ import (
 	"encoding/xml"
 )
 
-
 // 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.
 type xlsxSST struct {
 	XMLName     xml.Name `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main sst"`
-	Count       int   `xml:"count,attr"`
-	UniqueCount int   `xml:"uniqueCount,attr"`
+	Count       int      `xml:"count,attr"`
+	UniqueCount int      `xml:"uniqueCount,attr"`
 	SI          []xlsxSI `xml:"si"`
 }
 
@@ -32,10 +31,9 @@ type xlsxR struct {
 	T string `xml:"t"`
 }
 
-
 type RefTable struct {
 	indexedStrings []string
-	knownStrings map[string]int
+	knownStrings   map[string]int
 }
 
 // NewSharedStringRefTable() creates a new, empty RefTable.
@@ -87,7 +85,6 @@ func (rt *RefTable) ResolveSharedString(index int) string {
 	return rt.indexedStrings[index]
 }
 
-
 // AddString adds a string to the reference table and return it's
 // numeric index.  If the string already exists then it simply returns
 // the existing index.

+ 0 - 2
sharedstrings_test.go

@@ -98,7 +98,6 @@ func (s *SharedStringsSuite) TestMakeXLSXSST(c *C) {
 	c.Assert(si.T, Equals, "Foo")
 }
 
-
 func (s *SharedStringsSuite) TestMarshalSST(c *C) {
 	refTable := NewSharedStringRefTable()
 	refTable.AddString("Foo")
@@ -119,4 +118,3 @@ func (s *SharedStringsSuite) TestMarshalSST(c *C) {
   </sst>`
 	c.Assert(output.String(), Equals, expectedXLSXSST)
 }
-

+ 3 - 3
sheet.go

@@ -8,7 +8,7 @@ import (
 // Sheet is a high level structure intended to provide user access to
 // the contents of a particular sheet within an XLSX file.
 type Sheet struct {
-	Name	string
+	Name   string
 	Rows   []*Row
 	MaxRow int
 	MaxCol int
@@ -41,7 +41,7 @@ func (s *Sheet) makeXLSXSheet(refTable *RefTable) *xlsxWorksheet {
 				maxCell = c
 			}
 			xC := xlsxC{}
-			xC.R = fmt.Sprintf("%s%d", numericToLetters(c), r + 1)
+			xC.R = fmt.Sprintf("%s%d", numericToLetters(c), r+1)
 			xC.V = strconv.Itoa(refTable.AddString(cell.Value))
 			xC.T = "s" // Hardcode string type, for now.
 			xRow.C = append(xRow.C, xC)
@@ -51,7 +51,7 @@ func (s *Sheet) makeXLSXSheet(refTable *RefTable) *xlsxWorksheet {
 	worksheet.SheetData = xSheet
 	dimension := xlsxDimension{}
 	dimension.Ref = fmt.Sprintf("A1:%s%d",
-		numericToLetters(maxCell), maxRow + 1)
+		numericToLetters(maxCell), maxRow+1)
 	worksheet.Dimension = dimension
 	return worksheet
 }

+ 2 - 4
sheet_test.go

@@ -27,7 +27,7 @@ func (s *SheetSuite) TestMakeXLSXSheetFromRows(c *C) {
 	cell := row.AddCell()
 	cell.Value = "A cell!"
 	refTable := NewSharedStringRefTable()
-	xSheet:= sheet.makeXLSXSheet(refTable)
+	xSheet := sheet.makeXLSXSheet(refTable)
 	c.Assert(xSheet.Dimension.Ref, Equals, "A1:A1")
 	c.Assert(xSheet.SheetData.Row, HasLen, 1)
 	xRow := xSheet.SheetData.Row[0]
@@ -47,7 +47,6 @@ func (s *SheetSuite) TestMakeXLSXSheetFromRows(c *C) {
 	c.Assert(xSI.T, Equals, "A cell!")
 }
 
-
 func (s *SheetSuite) TestMarshalSheet(c *C) {
 	file := NewFile()
 	sheet := file.AddSheet("Sheet1")
@@ -55,7 +54,7 @@ func (s *SheetSuite) TestMarshalSheet(c *C) {
 	cell := row.AddCell()
 	cell.Value = "A cell!"
 	refTable := NewSharedStringRefTable()
-	xSheet:= sheet.makeXLSXSheet(refTable)
+	xSheet := sheet.makeXLSXSheet(refTable)
 
 	output := bytes.NewBufferString(xml.Header)
 	body, err := xml.MarshalIndent(xSheet, "  ", "  ")
@@ -76,4 +75,3 @@ func (s *SheetSuite) TestMarshalSheet(c *C) {
   </worksheet>`
 	c.Assert(output.String(), Equals, expectedXLSXSheet)
 }
-

+ 0 - 1
style.go

@@ -7,7 +7,6 @@
 
 package xlsx
 
-
 // xlsxStyle directly maps the style element in the namespace
 // http://schemas.openxmlformats.org/spreadsheetml/2006/main -
 // currently I have not checked it for completeness - it does as much

+ 19 - 19
workbook.go

@@ -10,7 +10,7 @@ import (
 // xmlxWorkbookRels contains xmlxWorkbookRelations
 // which maps sheet id and sheet XML
 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"`
 }
 
@@ -26,7 +26,7 @@ type xlsxWorkbookRelation struct {
 // currently I have not checked it for completeness - it does as much
 // as I need.
 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"`
 	WorkbookPr   xlsxWorkbookPr   `xml:"workbookPr"`
 	BookViews    xlsxBookViews    `xml:"bookViews"`
@@ -52,9 +52,9 @@ type xlsxFileVersion struct {
 // much as I need.
 type xlsxWorkbookPr struct {
 	DefaultThemeVersion string `xml:"defaultThemeVersion,attr,omitempty"`
-	BackupFile	bool `xml:"backupFile,attr,omitempty"`
-	ShowObjects	string `xml:"showObjects,attr,omitempty"`
-	Date1904	bool `xml:"date1904,attr"`
+	BackupFile          bool   `xml:"backupFile,attr,omitempty"`
+	ShowObjects         string `xml:"showObjects,attr,omitempty"`
+	Date1904            bool   `xml:"date1904,attr"`
 }
 
 // xlsxBookViews directly maps the bookViews element from the
@@ -70,16 +70,16 @@ type xlsxBookViews struct {
 // - currently I have not checked it for completeness - it does as
 // much as I need.
 type xlsxWorkBookView struct {
-	ActiveTab	int `xml:"activeTab,attr,omitempty"`
-	FirstSheet	int `xml:"firstSheet,attr,omitempty"`
-	ShowHorizontalScroll bool `xml:"showHorizontalScroll,attr,omitempty"`
-	ShowVerticalScroll bool `xml:"showVerticalScroll,attr,omitempty"`
-	ShowSheetTabs bool `xml:"showSheetTabs,attr,omitempty"`
-	TabRatio	int `xml:"tabRatio,attr,omitempty"`
-	WindowHeight	int `xml:"windowHeight,attr,omitempty"`
-	WindowWidth	int `xml:"windowWidth,attr,omitempty"`
-	XWindow      string `xml:"xWindow,attr,omitempty"`
-	YWindow      string `xml:"yWindow,attr,omitempty"`
+	ActiveTab            int    `xml:"activeTab,attr,omitempty"`
+	FirstSheet           int    `xml:"firstSheet,attr,omitempty"`
+	ShowHorizontalScroll bool   `xml:"showHorizontalScroll,attr,omitempty"`
+	ShowVerticalScroll   bool   `xml:"showVerticalScroll,attr,omitempty"`
+	ShowSheetTabs        bool   `xml:"showSheetTabs,attr,omitempty"`
+	TabRatio             int    `xml:"tabRatio,attr,omitempty"`
+	WindowHeight         int    `xml:"windowHeight,attr,omitempty"`
+	WindowWidth          int    `xml:"windowWidth,attr,omitempty"`
+	XWindow              string `xml:"xWindow,attr,omitempty"`
+	YWindow              string `xml:"yWindow,attr,omitempty"`
 }
 
 // xlsxSheets directly maps the sheets element from the namespace
@@ -123,10 +123,10 @@ type xlsxDefinedName struct {
 // currently I have not checked it for completeness - it does as much
 // as I need.
 type xlsxCalcPr struct {
-	CalcId string `xml:"calcId,attr,omitempty"`
-	IterateCount int `xml:"iterateCount,attr,omitempty"`
-	RefMode string `xml:"refMode,attr,omitempty"`
-	Iterate bool `xml:"iterate,attr,omitempty"`
+	CalcId       string  `xml:"calcId,attr,omitempty"`
+	IterateCount int     `xml:"iterateCount,attr,omitempty"`
+	RefMode      string  `xml:"refMode,attr,omitempty"`
+	Iterate      bool    `xml:"iterate,attr,omitempty"`
 	IterateDelta float64 `xml:"iterateDelta,attr,omitempty"`
 }
 

+ 1 - 2
workbook_test.go

@@ -64,7 +64,7 @@ func (w *WorkbookSuite) TestUnmarshallWorkbookXML(c *C) {
 	c.Assert(workBookView.YWindow, Equals, "75")
 	c.Assert(workBookView.WindowWidth, Equals, 15135)
 	c.Assert(workBookView.WindowHeight, Equals, 7620)
-	c.Assert(workbook.Sheets.Sheet, HasLen,  3)
+	c.Assert(workbook.Sheets.Sheet, HasLen, 3)
 	sheet := workbook.Sheets.Sheet[0]
 	c.Assert(sheet.Id, Equals, "rId1")
 	c.Assert(sheet.Name, Equals, "Sheet1")
@@ -77,7 +77,6 @@ func (w *WorkbookSuite) TestUnmarshallWorkbookXML(c *C) {
 	c.Assert(workbook.CalcPr.CalcId, Equals, "125725")
 }
 
-
 // Test we can marshall a Workbook to xml
 func (w *WorkbookSuite) TestMarshallWorkbook(c *C) {
 	var workbook *xlsxWorkbook

+ 7 - 7
worksheet.go

@@ -9,7 +9,7 @@ import (
 // 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"`
+	XMLName   xml.Name      `xml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main worksheet"`
 	Dimension xlsxDimension `xml:"dimension"`
 	SheetData xlsxSheetData `xml:"sheetData"`
 }
@@ -27,8 +27,8 @@ type xlsxDimension struct {
 // 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"`
+	XMLName xml.Name  `xml:"sheetData"`
+	Row     []xlsxRow `xml:"row"`
 }
 
 // xlsxRow directly maps the row element in the namespace
@@ -46,10 +46,10 @@ type xlsxRow struct {
 // 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.
-	T string `xml:"t,attr"`  // Type.
-	V string  `xml:"v"`       // Value
+	R string `xml:"r,attr"`           // Cell ID, e.g. A1
+	S int    `xml:"s,attr,omitempty"` // Style reference.
+	T string `xml:"t,attr"`           // Type.
+	V string `xml:"v"`                // Value
 }
 
 // get cell