@@ -47,23 +47,23 @@ type StreamWriter struct {
4747// 16MB. For example, set data for worksheet of size 102400 rows x 50 columns
4848// with numbers and style:
4949//
50- // file := excelize.NewFile()
50+ // f := excelize.NewFile()
5151// defer func() {
52- // if err := file .Close(); err != nil {
52+ // if err := f .Close(); err != nil {
5353// fmt.Println(err)
5454// }
5555// }()
56- // streamWriter , err := file .NewStreamWriter("Sheet1")
56+ // sw , err := f .NewStreamWriter("Sheet1")
5757// if err != nil {
5858// fmt.Println(err)
5959// return
6060// }
61- // styleID, err := file .NewStyle(&excelize.Style{Font: &excelize.Font{Color: "777777"}})
61+ // styleID, err := f .NewStyle(&excelize.Style{Font: &excelize.Font{Color: "777777"}})
6262// if err != nil {
6363// fmt.Println(err)
6464// return
6565// }
66- // if err := streamWriter .SetRow("A1",
66+ // if err := sw .SetRow("A1",
6767// []interface{}{
6868// excelize.Cell{StyleID: styleID, Value: "Data"},
6969// []excelize.RichTextRun{
@@ -80,30 +80,34 @@ type StreamWriter struct {
8080// for colID := 0; colID < 50; colID++ {
8181// row[colID] = rand.Intn(640000)
8282// }
83- // cell, _ := excelize.CoordinatesToCellName(1, rowID)
84- // if err := streamWriter.SetRow(cell, row); err != nil {
83+ // cell, err := excelize.CoordinatesToCellName(1, rowID)
84+ // if err != nil {
8585// fmt.Println(err)
86- // return
86+ // break
87+ // }
88+ // if err := sw.SetRow(cell, row); err != nil {
89+ // fmt.Println(err)
90+ // break
8791// }
8892// }
89- // if err := streamWriter .Flush(); err != nil {
93+ // if err := sw .Flush(); err != nil {
9094// fmt.Println(err)
9195// return
9296// }
93- // if err := file .SaveAs("Book1.xlsx"); err != nil {
97+ // if err := f .SaveAs("Book1.xlsx"); err != nil {
9498// fmt.Println(err)
9599// }
96100//
97101// Set cell value and cell formula for a worksheet with stream writer:
98102//
99- // err := streamWriter .SetRow("A1", []interface{}{
103+ // err := sw .SetRow("A1", []interface{}{
100104// excelize.Cell{Value: 1},
101105// excelize.Cell{Value: 2},
102106// excelize.Cell{Formula: "SUM(A1,B1)"}});
103107//
104108// Set cell value and rows style for a worksheet with stream writer:
105109//
106- // err := streamWriter .SetRow("A1", []interface{}{
110+ // err := sw .SetRow("A1", []interface{}{
107111// excelize.Cell{Value: 1}},
108112// excelize.RowOpts{StyleID: styleID, Height: 20, Hidden: false});
109113func (f * File ) NewStreamWriter (sheet string ) (* StreamWriter , error ) {
@@ -432,7 +436,7 @@ func (sw *StreamWriter) SetRow(cell string, values []interface{}, opts ...RowOpt
432436// the 'SetColWidth' function before the 'SetRow' function. For example set
433437// the width column B:C as 20:
434438//
435- // err := streamWriter .SetColWidth(2, 3, 20)
439+ // err := sw .SetColWidth(2, 3, 20)
436440func (sw * StreamWriter ) SetColWidth (min , max int , width float64 ) error {
437441 if sw .sheetWritten {
438442 return ErrStreamSetColWidth
0 commit comments