summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxuri <xuri.me@gmail.com>2021-01-08 23:57:13 +0800
committerxuri <xuri.me@gmail.com>2021-01-08 23:57:13 +0800
commita26675517e6326a7e3d3391f9de79d5efeb8bb90 (patch)
tree8c0dbf440227b52ab9334fb32f709e233b9ff2bc
parent22dc6ff33c24e25c0281401272c852f81c10a9f1 (diff)
This closes #756, not set the empty string for the cell when SetCellValue with nil
-rw-r--r--cell.go2
-rw-r--r--cell_test.go2
-rw-r--r--drawing.go2
-rw-r--r--xmlChart.go8
4 files changed, 7 insertions, 7 deletions
diff --git a/cell.go b/cell.go
index 4dd2830..3e63565 100644
--- a/cell.go
+++ b/cell.go
@@ -93,7 +93,7 @@ func (f *File) SetCellValue(sheet, axis string, value interface{}) error {
case bool:
err = f.SetCellBool(sheet, axis, v)
case nil:
- err = f.SetCellStr(sheet, axis, "")
+ break
default:
err = f.SetCellStr(sheet, axis, fmt.Sprint(value))
}
diff --git a/cell_test.go b/cell_test.go
index 8d3f774..2122eca 100644
--- a/cell_test.go
+++ b/cell_test.go
@@ -331,7 +331,7 @@ func TestFormattedValue2(t *testing.T) {
f.Styles.CellXfs.Xf = append(f.Styles.CellXfs.Xf, xlsxXf{
NumFmtID: nil,
})
- v = f.formattedValue(3, "43528")
+ _ = f.formattedValue(3, "43528")
// formatted value with empty number format
f.Styles.NumFmts = nil
diff --git a/drawing.go b/drawing.go
index de9905e..f0eb7e9 100644
--- a/drawing.go
+++ b/drawing.go
@@ -844,7 +844,7 @@ func (f *File) drawChartSeriesVal(v formatChartSeries, formatSet *formatChart) *
// drawChartSeriesMarker provides a function to draw the c:marker element by
// given data index and format sets.
func (f *File) drawChartSeriesMarker(i int, formatSet *formatChart) *cMarker {
- defaultSymbol := map[string]*attrValString{Scatter: &attrValString{Val: stringPtr("circle")}}
+ defaultSymbol := map[string]*attrValString{Scatter: {Val: stringPtr("circle")}}
marker := &cMarker{
Symbol: defaultSymbol[formatSet.Type],
Size: &attrValInt{Val: intPtr(5)},
diff --git a/xmlChart.go b/xmlChart.go
index fffdddd..ee2ad29 100644
--- a/xmlChart.go
+++ b/xmlChart.go
@@ -138,25 +138,25 @@ type aSchemeClr struct {
}
// attrValInt directly maps the val element with integer data type as an
-// attribute。
+// attribute.
type attrValInt struct {
Val *int `xml:"val,attr"`
}
// attrValFloat directly maps the val element with float64 data type as an
-// attribute。
+// attribute.
type attrValFloat struct {
Val *float64 `xml:"val,attr"`
}
// attrValBool directly maps the val element with boolean data type as an
-// attribute。
+// attribute.
type attrValBool struct {
Val *bool `xml:"val,attr"`
}
// attrValString directly maps the val element with string data type as an
-// attribute。
+// attribute.
type attrValString struct {
Val *string `xml:"val,attr"`
}