From 654a676d9395fa0e2a0429257dfa98be411503a5 Mon Sep 17 00:00:00 2001 From: Ri Xu Date: Thu, 29 Jun 2017 19:41:00 +0800 Subject: - New function `NewStyle()` added and function `SetCellStyle()` has been exported, relate issue #72; - go test and go doc updated --- excelize.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'excelize.go') diff --git a/excelize.go b/excelize.go index 8e91fea..4fdfc72 100644 --- a/excelize.go +++ b/excelize.go @@ -114,9 +114,9 @@ func (f *File) SetCellValue(sheet, axis string, value interface{}) { } } -// getCellStyle provides function to get cell style index by given worksheet +// GetCellStyle provides function to get cell style index by given worksheet // name and cell coordinates. -func (f *File) getCellStyle(sheet, axis string) int { +func (f *File) GetCellStyle(sheet, axis string) int { xlsx := f.workSheetReader(sheet) axis = strings.ToUpper(axis) f.mergeCellsParser(xlsx, axis) @@ -137,8 +137,9 @@ func (f *File) getCellStyle(sheet, axis string) int { // 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) { - if f.getCellStyle(sheet, axis) == 0 { - f.SetCellStyle(sheet, axis, axis, `{"number_format": 22}`) + if f.GetCellStyle(sheet, axis) == 0 { + style, _ := f.NewStyle(`{"number_format": 22}`) + f.SetCellStyle(sheet, axis, axis, style) } } -- cgit v1.2.1