diff options
author | xuri <xuri.me@gmail.com> | 2021-06-05 00:06:14 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2021-06-05 00:06:14 +0800 |
commit | d932e62a127da177769ec3f35aae985ca0a516db (patch) | |
tree | ff1448e98780342feaea9a5b6915bc46b9d84deb | |
parent | 58f9287559b26ec44a9a68c4351efa88327be51d (diff) |
This closes #855, fix missing formula cell when getting rows value
-rw-r--r-- | rows.go | 2 | ||||
-rw-r--r-- | rows_test.go | 8 | ||||
-rw-r--r-- | stream.go | 2 |
3 files changed, 9 insertions, 3 deletions
@@ -165,7 +165,7 @@ func rowXMLHandler(rowIterator *rowXMLIterator, xmlElement *xml.StartElement) { } blank := rowIterator.cellCol - len(rowIterator.columns) val, _ := colCell.getValueFrom(rowIterator.rows.f, rowIterator.d) - if val != "" { + if val != "" || colCell.F != nil { rowIterator.columns = append(appendSpace(blank, rowIterator.columns), val) } } diff --git a/rows_test.go b/rows_test.go index 5e7fd37..585fe59 100644 --- a/rows_test.go +++ b/rows_test.go @@ -138,12 +138,18 @@ func TestRowHeight(t *testing.T) { // Test set row height with custom default row height with prepare XML. assert.NoError(t, f.SetCellValue(sheet1, "A10", "A10")) + f.NewSheet("Sheet2") + assert.NoError(t, f.SetCellValue("Sheet2", "A2", true)) + height, err = f.GetRowHeight("Sheet2", 1) + assert.NoError(t, err) + assert.Equal(t, 15.0, height) + err = f.SaveAs(filepath.Join("test", "TestRowHeight.xlsx")) if !assert.NoError(t, err) { t.FailNow() } - convertColWidthToPixels(0) + assert.Equal(t, 0.0, convertColWidthToPixels(0)) } func TestColumns(t *testing.T) { @@ -333,7 +333,7 @@ func (sw *StreamWriter) SetRow(axis string, values []interface{}) error { } // SetColWidth provides a function to set the width of a single column or -// multiple columns for the the StreamWriter. Note that you must call +// multiple columns for the StreamWriter. Note that you must call // the 'SetColWidth' function before the 'SetRow' function. For example set // the width column B:C as 20: // |