forked from p30928647/excelize
This closes #756, not set the empty string for the cell when SetCellValue with nil
This commit is contained in:
parent
22dc6ff33c
commit
a26675517e
2
cell.go
2
cell.go
|
@ -93,7 +93,7 @@ func (f *File) SetCellValue(sheet, axis string, value interface{}) error {
|
||||||
case bool:
|
case bool:
|
||||||
err = f.SetCellBool(sheet, axis, v)
|
err = f.SetCellBool(sheet, axis, v)
|
||||||
case nil:
|
case nil:
|
||||||
err = f.SetCellStr(sheet, axis, "")
|
break
|
||||||
default:
|
default:
|
||||||
err = f.SetCellStr(sheet, axis, fmt.Sprint(value))
|
err = f.SetCellStr(sheet, axis, fmt.Sprint(value))
|
||||||
}
|
}
|
||||||
|
|
|
@ -331,7 +331,7 @@ func TestFormattedValue2(t *testing.T) {
|
||||||
f.Styles.CellXfs.Xf = append(f.Styles.CellXfs.Xf, xlsxXf{
|
f.Styles.CellXfs.Xf = append(f.Styles.CellXfs.Xf, xlsxXf{
|
||||||
NumFmtID: nil,
|
NumFmtID: nil,
|
||||||
})
|
})
|
||||||
v = f.formattedValue(3, "43528")
|
_ = f.formattedValue(3, "43528")
|
||||||
|
|
||||||
// formatted value with empty number format
|
// formatted value with empty number format
|
||||||
f.Styles.NumFmts = nil
|
f.Styles.NumFmts = nil
|
||||||
|
|
|
@ -844,7 +844,7 @@ func (f *File) drawChartSeriesVal(v formatChartSeries, formatSet *formatChart) *
|
||||||
// drawChartSeriesMarker provides a function to draw the c:marker element by
|
// drawChartSeriesMarker provides a function to draw the c:marker element by
|
||||||
// given data index and format sets.
|
// given data index and format sets.
|
||||||
func (f *File) drawChartSeriesMarker(i int, formatSet *formatChart) *cMarker {
|
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{
|
marker := &cMarker{
|
||||||
Symbol: defaultSymbol[formatSet.Type],
|
Symbol: defaultSymbol[formatSet.Type],
|
||||||
Size: &attrValInt{Val: intPtr(5)},
|
Size: &attrValInt{Val: intPtr(5)},
|
||||||
|
|
|
@ -138,25 +138,25 @@ type aSchemeClr struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// attrValInt directly maps the val element with integer data type as an
|
// attrValInt directly maps the val element with integer data type as an
|
||||||
// attribute。
|
// attribute.
|
||||||
type attrValInt struct {
|
type attrValInt struct {
|
||||||
Val *int `xml:"val,attr"`
|
Val *int `xml:"val,attr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// attrValFloat directly maps the val element with float64 data type as an
|
// attrValFloat directly maps the val element with float64 data type as an
|
||||||
// attribute。
|
// attribute.
|
||||||
type attrValFloat struct {
|
type attrValFloat struct {
|
||||||
Val *float64 `xml:"val,attr"`
|
Val *float64 `xml:"val,attr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// attrValBool directly maps the val element with boolean data type as an
|
// attrValBool directly maps the val element with boolean data type as an
|
||||||
// attribute。
|
// attribute.
|
||||||
type attrValBool struct {
|
type attrValBool struct {
|
||||||
Val *bool `xml:"val,attr"`
|
Val *bool `xml:"val,attr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// attrValString directly maps the val element with string data type as an
|
// attrValString directly maps the val element with string data type as an
|
||||||
// attribute。
|
// attribute.
|
||||||
type attrValString struct {
|
type attrValString struct {
|
||||||
Val *string `xml:"val,attr"`
|
Val *string `xml:"val,attr"`
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue