Skip to content

Commit

Permalink
This closes qax-os#1211, improve the compatibility with invalid inter…
Browse files Browse the repository at this point in the history
…nal styles count
  • Loading branch information
xuri committed Oct 9, 2022
1 parent 280fc13 commit 9c77e5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion styles.go
Expand Up @@ -2443,7 +2443,7 @@ func setCellXfs(style *xlsxStyleSheet, fontID, numFmtID, fillID, borderID int, a
if borderID != 0 {
xf.ApplyBorder = boolPtr(true)
}
style.CellXfs.Count++
style.CellXfs.Count = len(style.CellXfs.Xf) + 1
xf.Alignment = alignment
if alignment != nil {
xf.ApplyAlignment = boolPtr(applyAlignment)
Expand Down
4 changes: 2 additions & 2 deletions styles_test.go
Expand Up @@ -271,14 +271,14 @@ func TestNewStyle(t *testing.T) {
f.Styles.CellXfs.Xf = nil
style4, err := f.NewStyle(&Style{NumFmt: 160, Lang: "unknown"})
assert.NoError(t, err)
assert.Equal(t, 1, style4)
assert.Equal(t, 0, style4)

f = NewFile()
f.Styles.NumFmts = nil
f.Styles.CellXfs.Xf = nil
style5, err := f.NewStyle(&Style{NumFmt: 160, Lang: "zh-cn"})
assert.NoError(t, err)
assert.Equal(t, 1, style5)
assert.Equal(t, 0, style5)
}

func TestGetDefaultFont(t *testing.T) {
Expand Down

0 comments on commit 9c77e5c

Please sign in to comment.