|
|
@ -58,11 +58,19 @@ func TestStreamWriter(t *testing.T) {
|
|
|
|
// Test set cell with style and rich text.
|
|
|
|
// Test set cell with style and rich text.
|
|
|
|
styleID, err := file.NewStyle(&Style{Font: &Font{Color: "#777777"}})
|
|
|
|
styleID, err := file.NewStyle(&Style{Font: &Font{Color: "#777777"}})
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A4", []interface{}{Cell{StyleID: styleID}, Cell{Formula: "SUM(A10,B10)"}}, RowOpts{Height: 45, StyleID: styleID}))
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A4", []interface{}{
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A5", []interface{}{&Cell{StyleID: styleID, Value: "cell"}, &Cell{Formula: "SUM(A10,B10)"}, []RichTextRun{
|
|
|
|
Cell{StyleID: styleID},
|
|
|
|
|
|
|
|
Cell{Formula: "SUM(A10,B10)", Value: " preserve space "},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
RowOpts{Height: 45, StyleID: styleID}))
|
|
|
|
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A5", []interface{}{
|
|
|
|
|
|
|
|
&Cell{StyleID: styleID, Value: "cell <>&'\""},
|
|
|
|
|
|
|
|
&Cell{Formula: "SUM(A10,B10)"},
|
|
|
|
|
|
|
|
[]RichTextRun{
|
|
|
|
{Text: "Rich ", Font: &Font{Color: "2354e8"}},
|
|
|
|
{Text: "Rich ", Font: &Font{Color: "2354e8"}},
|
|
|
|
{Text: "Text", Font: &Font{Color: "e83723"}},
|
|
|
|
{Text: "Text", Font: &Font{Color: "e83723"}},
|
|
|
|
}}))
|
|
|
|
},
|
|
|
|
|
|
|
|
}))
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A6", []interface{}{time.Now()}))
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A6", []interface{}{time.Now()}))
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A7", nil, RowOpts{Height: 20, Hidden: true, StyleID: styleID}))
|
|
|
|
assert.NoError(t, streamWriter.SetRow("A7", nil, RowOpts{Height: 20, Hidden: true, StyleID: styleID}))
|
|
|
|
assert.EqualError(t, streamWriter.SetRow("A8", nil, RowOpts{Height: MaxRowHeight + 1}), ErrMaxRowHeight.Error())
|
|
|
|
assert.EqualError(t, streamWriter.SetRow("A8", nil, RowOpts{Height: MaxRowHeight + 1}), ErrMaxRowHeight.Error())
|
|
|
|