summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2018-04-09 19:44:08 +0800
committerRi Xu <xuri.me@gmail.com>2018-04-09 19:44:08 +0800
commit2b97c3bb463b28e3d81f714ef55798621174e0a1 (patch)
treeae0dae442897df0313d4deb4d0e8b66cff4869b1
parent564ebe48dd660347c7ac5cdebe3395e4a085f19b (diff)
- Support to read inlineStr type cell value, relate issue #208, PR #209;
- go test and godoc has been updated
-rw-r--r--rows.go2
-rw-r--r--test/Book1.xlsxbin22981 -> 23005 bytes
-rw-r--r--xmlWorksheet.go22
3 files changed, 24 insertions, 0 deletions
diff --git a/rows.go b/rows.go
index f7ae7f9..25a2049 100644
--- a/rows.go
+++ b/rows.go
@@ -174,6 +174,8 @@ func (xlsx *xlsxC) getValueFrom(f *File, d *xlsxSST) (string, error) {
return f.formattedValue(xlsx.S, d.SI[xlsxSI].T), nil
case "str":
return f.formattedValue(xlsx.S, xlsx.V), nil
+ case "inlineStr":
+ return f.formattedValue(xlsx.S, xlsx.IS.T), nil
default:
return f.formattedValue(xlsx.S, xlsx.V), nil
}
diff --git a/test/Book1.xlsx b/test/Book1.xlsx
index 7168ff1..f94dfe9 100644
--- a/test/Book1.xlsx
+++ b/test/Book1.xlsx
Binary files differ
diff --git a/xmlWorksheet.go b/xmlWorksheet.go
index 748ca1f..37c0d18 100644
--- a/xmlWorksheet.go
+++ b/xmlWorksheet.go
@@ -304,6 +304,19 @@ type xlsxDataValidations struct {
// 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.
+//
+// This simple type is restricted to the values listed in the following table:
+//
+// Enumeration Value | Description
+// ---------------------------+---------------------------------
+// b (Boolean) | Cell containing a boolean.
+// d (Date) | Cell contains a date in the ISO 8601 format.
+// e (Error) | Cell containing an error.
+// inlineStr (Inline String) | Cell containing an (inline) rich string, i.e., one not in the shared string table. If this cell type is used, then the cell value is in the is element rather than the v element in the cell (c element).
+// n (Number) | Cell containing a number.
+// s (Shared String) | Cell containing a shared string.
+// str (String) | Cell containing a formula string.
+//
type xlsxC struct {
R string `xml:"r,attr"` // Cell ID, e.g. A1
S int `xml:"s,attr,omitempty"` // Style reference.
@@ -311,9 +324,18 @@ type xlsxC struct {
T string `xml:"t,attr,omitempty"` // Type.
F *xlsxF `xml:"f,omitempty"` // Formula
V string `xml:"v,omitempty"` // Value
+ IS *xlsxIS `xml:"is"`
XMLSpace xml.Attr `xml:"space,attr,omitempty"`
}
+// xlsxIS directly maps the t element. Cell containing an (inline) rich
+// string, i.e., one not in the shared string table. If this cell type is
+// used, then the cell value is in the is element rather than the v element in
+// the cell (c element).
+type xlsxIS struct {
+ T string `xml:"t"`
+}
+
// 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.