From adf9d37d82edd3dbc365fece76a031a92e2220d6 Mon Sep 17 00:00:00 2001 From: xuri Date: Wed, 26 Oct 2022 00:04:23 +0800 Subject: This closes #1379, cleanup stream writer temporary files by the `Close` function - Fix error on inserting columns or rows on the worksheet which contains one cell merged cell range - Fix getting incomplete rich text cell value in some cases - Unit tests updated --- cell.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'cell.go') diff --git a/cell.go b/cell.go index 6ed7f48..fbc84b7 100644 --- a/cell.go +++ b/cell.go @@ -152,19 +152,19 @@ func (f *File) SetCellValue(sheet, cell string, value interface{}) error { // String extracts characters from a string item. func (x xlsxSI) String() string { - if len(x.R) > 0 { - var rows strings.Builder - for _, s := range x.R { - if s.T != nil { - rows.WriteString(s.T.Val) - } + var value strings.Builder + if x.T != nil { + value.WriteString(x.T.Val) + } + for _, s := range x.R { + if s.T != nil { + value.WriteString(s.T.Val) } - return bstrUnmarshal(rows.String()) } - if x.T != nil { - return bstrUnmarshal(x.T.Val) + if value.Len() == 0 { + return "" } - return "" + return bstrUnmarshal(value.String()) } // hasValue determine if cell non-blank value. -- cgit v1.2.1