summaryrefslogtreecommitdiff
path: root/excelize.go
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2018-01-05 09:39:31 +0800
committerRi Xu <xuri.me@gmail.com>2018-01-05 09:39:31 +0800
commit52b1a8e8963e9acfbabf76971656c0141b45ea9f (patch)
treee0e392dca30f79813b9f4ccb1dd1a4080ff0d438 /excelize.go
parente13ccce89a786683b9871d6d0f9cc5b52ff1a406 (diff)
- Function `SetCellValue()` time.Duration support added, relate issue #176;
- go test updated
Diffstat (limited to 'excelize.go')
-rw-r--r--excelize.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/excelize.go b/excelize.go
index b3abc30..0b1e410 100644
--- a/excelize.go
+++ b/excelize.go
@@ -70,10 +70,11 @@ func OpenReader(r io.Reader) (*File, error) {
}
// setDefaultTimeStyle provides function to set default numbers format for
-// time.Time type cell value by given worksheet name and cell coordinates.
-func (f *File) setDefaultTimeStyle(sheet, axis string) {
+// time.Time type cell value by given worksheet name, cell coordinates and
+// number format code.
+func (f *File) setDefaultTimeStyle(sheet, axis string, format int) {
if f.GetCellStyle(sheet, axis) == 0 {
- style, _ := f.NewStyle(`{"number_format": 22}`)
+ style, _ := f.NewStyle(`{"number_format": ` + strconv.Itoa(format) + `}`)
f.SetCellStyle(sheet, axis, axis, style)
}
}