From efcf599dfe2ec25f10c4d55513a5648addfe989b Mon Sep 17 00:00:00 2001 From: xuri Date: Wed, 28 Sep 2022 00:04:17 +0800 Subject: This closes #1360, closes #1361 - Fix default number format parse issue with a long string of digits - Fix creating a sheet with an empty name cause a corrupted file - The `GetCellStyle` function no longer return master cell style of the merge cell range - Using the specialized name in variables and functions --- styles.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'styles.go') diff --git a/styles.go b/styles.go index 587fd74..a4f5dc4 100644 --- a/styles.go +++ b/styles.go @@ -2486,11 +2486,14 @@ func (f *File) GetCellStyle(sheet, cell string) (int, error) { if err != nil { return 0, err } - c, col, row, err := f.prepareCell(ws, cell) + col, row, err := CellNameToCoordinates(cell) if err != nil { return 0, err } - return f.prepareCellStyle(ws, col, row, c.S), err + prepareSheetXML(ws, col, row) + ws.Lock() + defer ws.Unlock() + return f.prepareCellStyle(ws, col, row, ws.SheetData.Row[row-1].C[col-1].S), err } // SetCellStyle provides a function to add style attribute for cells by given @@ -2856,7 +2859,7 @@ func (f *File) SetCellStyle(sheet, hCell, vCell string, styleID int) error { // max_color - Same as min_color, see above. // // bar_color - Used for data_bar. Same as min_color, see above. -func (f *File) SetConditionalFormat(sheet, area, formatSet string) error { +func (f *File) SetConditionalFormat(sheet, reference, formatSet string) error { var format []*formatConditional err := json.Unmarshal([]byte(formatSet), &format) if err != nil { @@ -2897,7 +2900,7 @@ func (f *File) SetConditionalFormat(sheet, area, formatSet string) error { } ws.ConditionalFormatting = append(ws.ConditionalFormatting, &xlsxConditionalFormatting{ - SQRef: area, + SQRef: reference, CfRule: cfRule, }) return err -- cgit v1.2.1