Golang 1.9 compatible, fix issue #111

This commit is contained in:
Ri Xu 2017-09-01 12:59:15 +08:00
parent 1ec2661dda
commit 574a6b20d1
No known key found for this signature in database
GPG Key ID: BA5E5BB1C948EDF7
4 changed files with 11 additions and 14 deletions

13
cell.go
View File

@ -96,17 +96,8 @@ func (f *File) GetCellValue(sheet, axis string) string {
if axis != r.R { if axis != r.R {
continue continue
} }
switch r.T { val, _ := r.getValueFrom(f, f.sharedStringsReader())
case "s": return val
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)
}
} }
} }
return "" return ""

View File

@ -171,7 +171,7 @@ func (f *File) addComment(commentsXML, cell string, formatSet *formatComment) {
{ {
RPr: &xlsxRPr{ RPr: &xlsxRPr{
B: " ", B: " ",
Sz: &attrValInt{Val: 9}, Sz: &attrValFloat{Val: 9},
Color: &xlsxColor{ Color: &xlsxColor{
Indexed: 81, Indexed: 81,
}, },
@ -182,7 +182,7 @@ func (f *File) addComment(commentsXML, cell string, formatSet *formatComment) {
}, },
{ {
RPr: &xlsxRPr{ RPr: &xlsxRPr{
Sz: &attrValInt{Val: 9}, Sz: &attrValFloat{Val: 9},
Color: &xlsxColor{ Color: &xlsxColor{
Indexed: 81, Indexed: 81,
}, },

View File

@ -135,6 +135,12 @@ type attrValInt struct {
Val int `xml:"val,attr"` 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 // attrValBool directly maps the val element with boolean data type as an
// attribute。 // attribute。
type attrValBool struct { type attrValBool struct {

View File

@ -39,7 +39,7 @@ type xlsxR struct {
// styles. // styles.
type xlsxRPr struct { type xlsxRPr struct {
B string `xml:"b,omitempty"` B string `xml:"b,omitempty"`
Sz *attrValInt `xml:"sz"` Sz *attrValFloat `xml:"sz"`
Color *xlsxColor `xml:"color"` Color *xlsxColor `xml:"color"`
RFont *attrValString `xml:"rFont"` RFont *attrValString `xml:"rFont"`
Family *attrValInt `xml:"family"` Family *attrValInt `xml:"family"`