|
@@ -4,6 +4,7 @@ import (
|
|
|
"archive/zip"
|
|
"archive/zip"
|
|
|
"io"
|
|
"io"
|
|
|
"os"
|
|
"os"
|
|
|
|
|
+ "strconv"
|
|
|
"xml"
|
|
"xml"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -26,6 +27,15 @@ type Cell struct {
|
|
|
data string
|
|
data string
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// CellInterface defines the public API of the Cell.
|
|
|
|
|
+type CellInterface interface {
|
|
|
|
|
+ String() string
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+func (c *Cell) String() string {
|
|
|
|
|
+ return c.data
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// Row is a high level structure indended to provide user access to a
|
|
// Row is a high level structure indended to provide user access to a
|
|
|
// row within a xlsx.Sheet. An xlsx.Row contains a slice of xlsx.Cell.
|
|
// row within a xlsx.Sheet. An xlsx.Row contains a slice of xlsx.Cell.
|
|
|
type Row struct {
|
|
type Row struct {
|
|
@@ -58,7 +68,11 @@ func readRowsFromSheet(worksheet *XLSXWorksheet, reftable []string) []*Row {
|
|
|
row.Cells = make([]*Cell, len(rawrow.C))
|
|
row.Cells = make([]*Cell, len(rawrow.C))
|
|
|
for j, rawcell := range rawrow.C {
|
|
for j, rawcell := range rawrow.C {
|
|
|
cell := new(Cell)
|
|
cell := new(Cell)
|
|
|
- cell.data = rawcell.V.Data
|
|
|
|
|
|
|
+ ref, error := strconv.Atoi(rawcell.V.Data)
|
|
|
|
|
+ if error != nil {
|
|
|
|
|
+ panic("Invalid reference in Excel Cell (not found in sharedStrings.xml")
|
|
|
|
|
+ }
|
|
|
|
|
+ cell.data = reftable[ref]
|
|
|
row.Cells[j] = cell
|
|
row.Cells[j] = cell
|
|
|
}
|
|
}
|
|
|
rows[i] = row
|
|
rows[i] = row
|