From 52b1a8e8963e9acfbabf76971656c0141b45ea9f Mon Sep 17 00:00:00 2001 From: Ri Xu Date: Fri, 5 Jan 2018 09:39:31 +0800 Subject: - Function `SetCellValue()` time.Duration support added, relate issue #176; - go test updated --- excelize.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'excelize.go') 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) } } -- cgit v1.2.1