summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2017-09-01 12:59:15 +0800
committerRi Xu <xuri.me@gmail.com>2017-09-01 12:59:15 +0800
commit574a6b20d1c9c15b12e2fe6d834e0cbb55a504d7 (patch)
treea184548ad353494d5b383fea3b3c1ed73b785072
parent1ec2661dda1ef16f58b2a3d614b11a2bcd0a2f2f (diff)
Golang 1.9 compatible, fix issue #111
-rw-r--r--cell.go13
-rw-r--r--comment.go4
-rw-r--r--xmlChart.go6
-rw-r--r--xmlSharedStrings.go2
4 files changed, 11 insertions, 14 deletions
diff --git a/cell.go b/cell.go
index b182e2b..ca590a9 100644
--- a/cell.go
+++ b/cell.go
@@ -96,17 +96,8 @@ func (f *File) GetCellValue(sheet, axis string) string {
if axis != r.R {
continue
}
- switch r.T {
- case "s":
- shardStrings := f.sharedStringsReader()
- xlsxSI := 0
- xlsxSI, _ = strconv.Atoi(r.V)
- return f.formattedValue(r.S, shardStrings.SI[xlsxSI].T)
- case "str":
- return f.formattedValue(r.S, r.V)
- default:
- return f.formattedValue(r.S, r.V)
- }
+ val, _ := r.getValueFrom(f, f.sharedStringsReader())
+ return val
}
}
return ""
diff --git a/comment.go b/comment.go
index 3f57c84..6f2d624 100644
--- a/comment.go
+++ b/comment.go
@@ -171,7 +171,7 @@ func (f *File) addComment(commentsXML, cell string, formatSet *formatComment) {
{
RPr: &xlsxRPr{
B: " ",
- Sz: &attrValInt{Val: 9},
+ Sz: &attrValFloat{Val: 9},
Color: &xlsxColor{
Indexed: 81,
},
@@ -182,7 +182,7 @@ func (f *File) addComment(commentsXML, cell string, formatSet *formatComment) {
},
{
RPr: &xlsxRPr{
- Sz: &attrValInt{Val: 9},
+ Sz: &attrValFloat{Val: 9},
Color: &xlsxColor{
Indexed: 81,
},
diff --git a/xmlChart.go b/xmlChart.go
index 3352e08..5ca3586 100644
--- a/xmlChart.go
+++ b/xmlChart.go
@@ -135,6 +135,12 @@ type attrValInt struct {
Val int `xml:"val,attr"`
}
+// attrValFloat directly maps the val element with float64 data type as an
+// attribute。
+type attrValFloat struct {
+ Val float64 `xml:"val,attr"`
+}
+
// attrValBool directly maps the val element with boolean data type as an
// attribute。
type attrValBool struct {
diff --git a/xmlSharedStrings.go b/xmlSharedStrings.go
index 878c08d..c8b54a0 100644
--- a/xmlSharedStrings.go
+++ b/xmlSharedStrings.go
@@ -39,7 +39,7 @@ type xlsxR struct {
// styles.
type xlsxRPr struct {
B string `xml:"b,omitempty"`
- Sz *attrValInt `xml:"sz"`
+ Sz *attrValFloat `xml:"sz"`
Color *xlsxColor `xml:"color"`
RFont *attrValString `xml:"rFont"`
Family *attrValInt `xml:"family"`