summaryrefslogtreecommitdiff
path: root/excelize.go
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2016-11-24 11:42:51 +0800
committerRi Xu <xuri.me@gmail.com>2016-11-24 11:42:51 +0800
commit2a3620e750df7dc8c24791d51ca8e06c0f68799c (patch)
tree463b4ad036ec204cb320912b47215e10e9eced94 /excelize.go
parent6adcb9d88fe93ce390a89eb83e78d42b94007a43 (diff)
BugFix: `SetCellValue` function assertion logic will cause panic in some case.
Diffstat (limited to 'excelize.go')
-rw-r--r--excelize.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/excelize.go b/excelize.go
index 33e2449..bb0659a 100644
--- a/excelize.go
+++ b/excelize.go
@@ -37,8 +37,20 @@ func OpenFile(filename string) (*File, error) {
// SetCellValue provide function to set int or string type value of a cell.
func (f *File) SetCellValue(sheet string, axis string, value interface{}) {
switch t := value.(type) {
- case int, int8, int16, int32, int64, float32, float64:
+ case int:
f.SetCellInt(sheet, axis, value.(int))
+ case int8:
+ f.SetCellInt(sheet, axis, int(value.(int8)))
+ case int16:
+ f.SetCellInt(sheet, axis, int(value.(int16)))
+ case int32:
+ f.SetCellInt(sheet, axis, int(value.(int32)))
+ case int64:
+ f.SetCellInt(sheet, axis, int(value.(int64)))
+ case float32:
+ f.SetCellInt(sheet, axis, int(value.(float32)))
+ case float64:
+ f.SetCellInt(sheet, axis, int(value.(float64)))
case string:
f.SetCellStr(sheet, axis, t)
case []byte: