summaryrefslogtreecommitdiff
path: root/excelize.go
diff options
context:
space:
mode:
authorRi Xu <xuri.me@gmail.com>2017-06-29 19:41:00 +0800
committerRi Xu <xuri.me@gmail.com>2017-06-29 19:41:00 +0800
commit654a676d9395fa0e2a0429257dfa98be411503a5 (patch)
tree10ddd9347dda52541f016e8b6ef5572050b8b248 /excelize.go
parente05867a033cabfa100e7c2b284e1f85fd4769c3c (diff)
- New function `NewStyle()` added and function `SetCellStyle()` has been exported, relate issue #72;
- go test and go doc updated
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)
}
}