Permalink
Browse files

only exporting proper things

  • Loading branch information...
1 parent f864c30 commit ce25865accbbba5a138d55432815f995f11ccabc Steven Degutis committed Apr 11, 2012
Showing with 102 additions and 102 deletions.
  1. +11 −11 lib.go
  2. +11 −11 lib_test.go
  3. +9 −9 sharedstrings.go
  4. +5 −5 sharedstrings_test.go
  5. +33 −33 workbook.go
  6. +3 −3 workbook_test.go
  7. +28 −28 worksheet.go
  8. +2 −2 worksheet_test.go
View
22 lib.go
@@ -109,20 +109,20 @@ func lettersToNumeric(letters string) int {
// 0s and therefore A can be both a 1 and a 0. The
// value range of a letter is different in the most
// significant position if (and only if) there is more
- // than one positions. For example:
- // "A" = 0
+ // than one positions. For example:
+ // "A" = 0
// 676 | 26 | 0
// ----+----+----
// 0 | 0 | 0
- //
+ //
// "Z" = 25
// 676 | 26 | 0
// ----+----+----
// 0 | 0 | 25
// "AA" = 26
// 676 | 26 | 0
// ----+----+----
- // 0 | 1 | 0 <--- note here - the value of "A" maps to both 1 and 0.
+ // 0 | 1 | 0 <--- note here - the value of "A" maps to both 1 and 0.
if i == 0 && extent > 1 {
shift = 1
} else {
@@ -200,8 +200,8 @@ func makeRowFromSpan(spans string) *Row {
}
// getValueFromCellData attempts to extract a valid value, usable in CSV form from the raw cell value.
-// Note - this is not actually general enough - we should support retaining tabs and newlines.
-func getValueFromCellData(rawcell XLSXC, reftable []string) string {
+// Note - this is not actually general enough - we should support retaining tabs and newlines.
+func getValueFromCellData(rawcell xlsxC, reftable []string) string {
var value string = ""
var data string = rawcell.V
if len(data) > 0 {
@@ -222,7 +222,7 @@ func getValueFromCellData(rawcell XLSXC, reftable []string) string {
// readRowsFromSheet is an internal helper function that extracts the
// rows from a XSLXWorksheet, poulates them with Cells and resolves
// the value references from the reference table and stores them in
-func readRowsFromSheet(Worksheet *XLSXWorksheet, reftable []string) []*Row {
+func readRowsFromSheet(Worksheet *xlsxWorksheet, reftable []string) []*Row {
var rows []*Row
var row *Row
@@ -245,11 +245,11 @@ func readRowsFromSheet(Worksheet *XLSXWorksheet, reftable []string) []*Row {
// over the Worksheets defined in the XSLXWorkbook and loads them into
// Sheet objects stored in the Sheets slice of a xlsx.File struct.
func readSheetsFromZipFile(f *zip.File, file *File) ([]*Sheet, error) {
- var workbook *XLSXWorkbook
+ var workbook *xlsxWorkbook
var error error
var rc io.ReadCloser
var decoder *xml.Decoder
- workbook = new(XLSXWorkbook)
+ workbook = new(xlsxWorkbook)
rc, error = f.Open()
if error != nil {
return nil, error
@@ -276,7 +276,7 @@ func readSheetsFromZipFile(f *zip.File, file *File) ([]*Sheet, error) {
// extract a reference table from the sharedStrings.xml file within
// the XLSX zip file.
func readSharedStringsFromZipFile(f *zip.File) ([]string, error) {
- var sst *XLSXSST
+ var sst *xlsxSST
var error error
var rc io.ReadCloser
var decoder *xml.Decoder
@@ -285,7 +285,7 @@ func readSharedStringsFromZipFile(f *zip.File) ([]string, error) {
if error != nil {
return nil, error
}
- sst = new(XLSXSST)
+ sst = new(xlsxSST)
decoder = xml.NewDecoder(rc)
error = decoder.Decode(sst)
if error != nil {
View
22 lib_test.go
@@ -249,7 +249,7 @@ func TestReadRowsFromSheet(t *testing.T) {
</sst>`)
var sheetxml = bytes.NewBufferString(`
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
+<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
<dimension ref="A1:B2"/>
<sheetViews>
@@ -276,19 +276,19 @@ func TestReadRowsFromSheet(t *testing.T) {
</c>
</row>
</sheetData>
- <pageMargins left="0.7" right="0.7"
- top="0.78740157499999996"
- bottom="0.78740157499999996"
- header="0.3"
+ <pageMargins left="0.7" right="0.7"
+ top="0.78740157499999996"
+ bottom="0.78740157499999996"
+ header="0.3"
footer="0.3"/>
</worksheet>`)
- worksheet := new(XLSXWorksheet)
+ worksheet := new(xlsxWorksheet)
error := xml.NewDecoder(sheetxml).Decode(worksheet)
if error != nil {
t.Error(error.Error())
return
}
- sst := new(XLSXSST)
+ sst := new(xlsxSST)
error = xml.NewDecoder(sharedstringsXML).Decode(sst)
if error != nil {
t.Error(error.Error())
@@ -373,13 +373,13 @@ func TestReadRowsFromSheetWithEmptyCells(t *testing.T) {
</worksheet>
`)
- worksheet := new(XLSXWorksheet)
+ worksheet := new(xlsxWorksheet)
error := xml.NewDecoder(sheetxml).Decode(worksheet)
if error != nil {
t.Error(error.Error())
return
}
- sst := new(XLSXSST)
+ sst := new(xlsxSST)
error = xml.NewDecoder(sharedstringsXML).Decode(sst)
if error != nil {
t.Error(error.Error())
@@ -419,13 +419,13 @@ func TestReadRowsFromSheetWithTrailingEmptyCells(t *testing.T) {
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><dimension ref="A1:D8"/><sheetViews><sheetView tabSelected="1" workbookViewId="0"><selection activeCell="A7" sqref="A7"/></sheetView></sheetViews><sheetFormatPr baseColWidth="10" defaultRowHeight="15"/><sheetData><row r="1" spans="1:4"><c r="A1" t="s"><v>0</v></c><c r="B1" t="s"><v>1</v></c><c r="C1" t="s"><v>2</v></c><c r="D1" t="s"><v>3</v></c></row><row r="2" spans="1:4"><c r="A2"><v>1</v></c></row><row r="3" spans="1:4"><c r="B3"><v>1</v></c></row><row r="4" spans="1:4"><c r="C4"><v>1</v></c></row><row r="5" spans="1:4"><c r="D5"><v>1</v></c></row><row r="6" spans="1:4"><c r="C6"><v>1</v></c></row><row r="7" spans="1:4"><c r="B7"><v>1</v></c></row><row r="8" spans="1:4"><c r="A8"><v>1</v></c></row></sheetData><pageMargins left="0.7" right="0.7" top="0.78740157499999996" bottom="0.78740157499999996" header="0.3" footer="0.3"/></worksheet>
`)
- worksheet := new(XLSXWorksheet)
+ worksheet := new(xlsxWorksheet)
error := xml.NewDecoder(sheetxml).Decode(worksheet)
if error != nil {
t.Error(error.Error())
return
}
- sst := new(XLSXSST)
+ sst := new(xlsxSST)
error = xml.NewDecoder(sharedstringsXML).Decode(sst)
if error != nil {
t.Error(error.Error())
View
18 sharedstrings.go
@@ -1,38 +1,38 @@
package xlsx
-// 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 need.
-type XLSXSST struct {
+type xlsxSST struct {
Count string `xml:"count,attr"`
UniqueCount string `xml:"uniqueCount,attr"`
- SI []XLSXSI `xml:"si"`
+ SI []xlsxSI `xml:"si"`
}
-// 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.
-type XLSXSI struct {
+type xlsxSI struct {
T string `xml:"t"`
}
-// // XLSXT directly maps the t element from the namespace
+// // xlsxT directly maps the t 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 XLSXT struct {
+// type xlsxT struct {
// Data string `xml:"chardata"`
// }
-// MakeSharedStringRefTable() takes an XLSXSST struct and converts
+// MakeSharedStringRefTable() takes an xlsxSST struct and converts
// it's contents to an slice of strings used to refer to string values
// by numeric index - this is the model used within XLSX worksheet (a
// numeric reference is stored to a shared cell value).
-func MakeSharedStringRefTable(source *XLSXSST) []string {
+func MakeSharedStringRefTable(source *xlsxSST) []string {
reftable := make([]string, len(source.SI))
for i, si := range source.SI {
reftable[i] = si.T
View
10 sharedstrings_test.go
@@ -6,11 +6,11 @@ import (
"testing"
)
-// Test we can correctly convert a XLSXSST into a reference table using xlsx.MakeSharedStringRefTable().
+// Test we can correctly convert a xlsxSST into a reference table using xlsx.MakeSharedStringRefTable().
func TestMakeSharedStringRefTable(t *testing.T) {
var sharedstringsXML = bytes.NewBufferString(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="4" uniqueCount="4"><si><t>Foo</t></si><si><t>Bar</t></si><si><t xml:space="preserve">Baz </t></si><si><t>Quuk</t></si></sst>`)
- sst := new(XLSXSST)
+ sst := new(xlsxSST)
error := xml.NewDecoder(sharedstringsXML).Decode(sst)
if error != nil {
t.Error(error.Error())
@@ -34,7 +34,7 @@ func TestMakeSharedStringRefTable(t *testing.T) {
func TestResolveSharedString(t *testing.T) {
var sharedstringsXML = bytes.NewBufferString(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="4" uniqueCount="4"><si><t>Foo</t></si><si><t>Bar</t></si><si><t xml:space="preserve">Baz </t></si><si><t>Quuk</t></si></sst>`)
- sst := new(XLSXSST)
+ sst := new(xlsxSST)
error := xml.NewDecoder(sharedstringsXML).Decode(sst)
if error != nil {
t.Error(error.Error())
@@ -47,11 +47,11 @@ func TestResolveSharedString(t *testing.T) {
}
// Test we can correctly unmarshal an the sharedstrings.xml file into
-// an xlsx.XLSXSST struct and it's associated children.
+// an xlsx.xlsxSST struct and it's associated children.
func TestUnmarshallSharedStrings(t *testing.T) {
var sharedstringsXML = bytes.NewBufferString(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="4" uniqueCount="4"><si><t>Foo</t></si><si><t>Bar</t></si><si><t xml:space="preserve">Baz </t></si><si><t>Quuk</t></si></sst>`)
- sst := new(XLSXSST)
+ sst := new(xlsxSST)
error := xml.NewDecoder(sharedstringsXML).Decode(sst)
if error != nil {
t.Error(error.Error())
View
66 workbook.go
@@ -7,108 +7,108 @@ import (
"io"
)
-// 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.
-type XLSXWorkbook struct {
- FileVersion XLSXFileVersion `xml:"fileVersion"`
- WorkbookPr XLSXWorkbookPr `xml:"workbookPr"`
- BookViews XLSXBookViews `xml:"bookViews"`
- Sheets XLSXSheets `xml:"sheets"`
- DefinedNames XLSXDefinedNames `xml:"definedNames"`
- CalcPr XLSXCalcPr `xml:"calcPr"`
+type xlsxWorkbook struct {
+ FileVersion xlsxFileVersion `xml:"fileVersion"`
+ WorkbookPr xlsxWorkbookPr `xml:"workbookPr"`
+ BookViews xlsxBookViews `xml:"bookViews"`
+ Sheets xlsxSheets `xml:"sheets"`
+ DefinedNames xlsxDefinedNames `xml:"definedNames"`
+ CalcPr xlsxCalcPr `xml:"calcPr"`
}
-// XLSXFileVersion directly maps the fileVersion element from the
+// xlsxFileVersion directly maps the fileVersion 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.
-type XLSXFileVersion struct {
+type xlsxFileVersion struct {
AppName string `xml:"appName,attr"`
LastEdited string `xml:"lastEdited,attr"`
LowestEdited string `xml:"lowestEdited,attr"`
RupBuild string `xml:"rupBuild,attr"`
}
-// XLSXWorkbookPr directly maps the workbookPr element from the
+// xlsxWorkbookPr directly maps the workbookPr 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.
-type XLSXWorkbookPr struct {
+type xlsxWorkbookPr struct {
DefaultThemeVersion string `xml:"defaultThemeVersion,attr"`
}
-// XLSXBookViews directly maps the bookViews element from the
+// xlsxBookViews directly maps the bookViews 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.
-type XLSXBookViews struct {
- WorkBookView []XLSXWorkBookView `xml:"workbookView"`
+type xlsxBookViews struct {
+ WorkBookView []xlsxWorkBookView `xml:"workbookView"`
}
-// XLSXWorkBookView directly maps the workbookView element from the
+// xlsxWorkBookView directly maps the workbookView 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.
-type XLSXWorkBookView struct {
+type xlsxWorkBookView struct {
XWindow string `xml:"xWindow,attr"`
YWindow string `xml:"yWindow,attr"`
WindowWidth string `xml:"windowWidth,attr"`
WindowHeight string `xml:"windowHeight,attr"`
}
-// XLSXSheets directly maps the sheets element from the namespace
+// xlsxSheets directly maps the sheets 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.
-type XLSXSheets struct {
- Sheet []XLSXSheet `xml:"sheet"`
+type xlsxSheets struct {
+ Sheet []xlsxSheet `xml:"sheet"`
}
-// 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.
-type XLSXSheet struct {
+type xlsxSheet struct {
Name string `xml:"name,attr"`
SheetId string `xml:"sheetId,attr"`
Id string `xml:"id,attr"`
}
-// XLSXDefinedNames directly maps the definedNames element from the
+// xlsxDefinedNames directly maps the definedNames 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.
-type XLSXDefinedNames struct {
- DefinedName []XLSXDefinedName `xml:"definedName"`
+type xlsxDefinedNames struct {
+ DefinedName []xlsxDefinedName `xml:"definedName"`
}
-// XLSXDefinedName directly maps the definedName element from the
+// xlsxDefinedName directly maps the definedName 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.
-type XLSXDefinedName struct {
+type xlsxDefinedName struct {
Data string `xml:",chardata"`
Name string `xml:"name,attr"`
LocalSheetID string `xml:"localSheetId,attr"`
}
-// XLSXCalcPr directly maps the calcPr element from the namespace
+// xlsxCalcPr directly maps the calcPr 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.
-type XLSXCalcPr struct {
+type xlsxCalcPr struct {
CalcId string `xml:"calcId,attr"`
}
-// getWorksheetFromSheet() is an internal helper function to open a sheetN.xml file, refered to by an xlsx.XLSXSheet struct, from the XLSX file and unmarshal it an xlsx.XLSXWorksheet struct
-func getWorksheetFromSheet(sheet XLSXSheet, worksheets map[string]*zip.File) (*XLSXWorksheet, error) {
+// getWorksheetFromSheet() is an internal helper function to open a sheetN.xml file, refered to by an xlsx.xlsxSheet struct, from the XLSX file and unmarshal it an xlsx.xlsxWorksheet struct
+func getWorksheetFromSheet(sheet xlsxSheet, worksheets map[string]*zip.File) (*xlsxWorksheet, error) {
var rc io.ReadCloser
var decoder *xml.Decoder
- var worksheet *XLSXWorksheet
+ var worksheet *xlsxWorksheet
var error error
- worksheet = new(XLSXWorksheet)
+ worksheet = new(xlsxWorksheet)
sheetName := fmt.Sprintf("sheet%s", sheet.SheetId)
f := worksheets[sheetName]
rc, error = f.Open()
View
6 workbook_test.go
@@ -7,13 +7,13 @@ import (
)
// Test we can succesfully unmarshal the workbook.xml file from within
-// an XLSX file and return a XLSXWorkbook struct (and associated
+// an XLSX file and return a xlsxWorkbook struct (and associated
// children).
func TestUnmarshallWorkbookXML(t *testing.T) {
var error error
var buf = bytes.NewBufferString(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="xl" lastEdited="4" lowestEdited="4" rupBuild="4506"/><workbookPr defaultThemeVersion="124226"/><bookViews><workbookView xWindow="120" yWindow="75" windowWidth="15135" windowHeight="7620"/></bookViews><sheets><sheet name="Sheet1" sheetId="1" r:id="rId1"/><sheet name="Sheet2" sheetId="2" r:id="rId2"/><sheet name="Sheet3" sheetId="3" r:id="rId3"/></sheets><definedNames><definedName name="monitors" localSheetId="0">Sheet1!$A$1533</definedName></definedNames><calcPr calcId="125725"/></workbook>`)
- var workbook *XLSXWorkbook
- workbook = new(XLSXWorkbook)
+ var workbook *xlsxWorkbook
+ workbook = new(xlsxWorkbook)
error = xml.NewDecoder(buf).Decode(workbook)
if error != nil {
t.Error(error.Error())
View
56 worksheet.go
@@ -1,96 +1,96 @@
package xlsx
-// 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.
-type XLSXWorksheet struct {
- Dimension XLSXDimension `xml:"dimension"`
- SheetViews XLSXSheetViews `xml:"sheetViews"`
- SheetFormatPr XLSXSheetFormatPr `xml:"sheetFormatPr"`
- SheetData XLSXSheetData `xml:"sheetData"`
+type xlsxWorksheet struct {
+ Dimension xlsxDimension `xml:"dimension"`
+ SheetViews xlsxSheetViews `xml:"sheetViews"`
+ SheetFormatPr xlsxSheetFormatPr `xml:"sheetFormatPr"`
+ SheetData xlsxSheetData `xml:"sheetData"`
}
-// 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 -
// currently I have not checked it for completeness - it does as much
// as I need.
-type XLSXDimension struct {
+type xlsxDimension struct {
Ref string `xml:"ref,attr"`
}
-// 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 -
// currently I have not checked it for completeness - it does as much
// as I need.
-type XLSXSheetViews struct {
- SheetView []XLSXSheetView `xml:"sheetView"`
+type xlsxSheetViews struct {
+ 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.
-type XLSXSheetView struct {
+type xlsxSheetView struct {
TabSelected string `xml:"tabSelected,attr"`
WorkbookViewID string `xml:"workbookViewId,attr"`
- Selection XLSXSelection `xml:"selection"`
+ Selection xlsxSelection `xml:"selection"`
}
-// 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 -
// currently I have not checked it for completeness - it does as much
// as I need.
-type XLSXSelection struct {
+type xlsxSelection struct {
ActiveCell string `xml:"activeCell,attr"`
SQRef string `xml:"sqref,attr"`
}
-// 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.
-type XLSXSheetFormatPr struct {
+type xlsxSheetFormatPr struct {
BaseColWidth string `xml:"baseColWidth,attr"`
DefaultRowHeight string `xml:"defaultRowHeight,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.
-type XLSXSheetData struct {
- Row []XLSXRow `xml:"row"`
+type xlsxSheetData struct {
+ Row []xlsxRow `xml:"row"`
}
-// XLSXRow directly maps the row element in the namespace
+// xlsxRow directly maps the row element in the namespace
// http://schemas.openxmlformats.org/spreadsheetml/2006/main -
// currently I have not checked it for completeness - it does as much
// as I need.
-type XLSXRow struct {
+type xlsxRow struct {
R string `xml:"r,attr"`
Spans string `xml:"spans,attr"`
- C []XLSXC `xml:"c"`
+ C []xlsxC `xml:"c"`
}
-// 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.
-type XLSXC struct {
+type xlsxC struct {
R string `xml:"r,attr"`
T string `xml:"t,attr"`
V string `xml:"v"`
}
-// XLSXV directly maps the v element in the namespace
+// xlsxV directly maps the v element in the namespace
// http://schemas.openxmlformats.org/spreadsheetml/2006/main -
// currently I have not checked it for completeness - it does as much
// as I need.
-// type XLSXV struct {
+// type xlsxV struct {
// Data string `xml:"chardata"`
// }
View
4 worksheet_test.go
@@ -8,11 +8,11 @@ import (
)
// Test we can succesfully unmarshal the sheetN.xml files within and
-// XLSX file into an XLSXWorksheet struct (and it's related children).
+// XLSX file into an xlsxWorksheet struct (and it's related children).
func TestUnmarshallWorksheet(t *testing.T) {
var sheetxml = bytes.NewBufferString(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><dimension ref="A1:B2"/><sheetViews><sheetView tabSelected="1" workbookViewId="0"><selection activeCell="C2" sqref="C2"/></sheetView></sheetViews><sheetFormatPr baseColWidth="10" defaultRowHeight="15"/><sheetData><row r="1" spans="1:2"><c r="A1" t="s"><v>0</v></c><c r="B1" t="s"><v>1</v></c></row><row r="2" spans="1:2"><c r="A2" t="s"><v>2</v></c><c r="B2" t="s"><v>3</v></c></row></sheetData><pageMargins left="0.7" right="0.7" top="0.78740157499999996" bottom="0.78740157499999996" header="0.3" footer="0.3"/></worksheet>`)
- worksheet := new(XLSXWorksheet)
+ worksheet := new(xlsxWorksheet)
error := xml.NewDecoder(sheetxml).Decode(worksheet)
if error != nil {
t.Error(error.Error())

0 comments on commit ce25865

Please sign in to comment.