summaryrefslogtreecommitdiff
path: root/excelize.go
diff options
context:
space:
mode:
Diffstat (limited to 'excelize.go')
-rw-r--r--excelize.go9
1 files changed, 5 insertions, 4 deletions
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)
}
}