Skip to content

Commit b51ddfe

Browse files
authored
Merge pull request #11 from tomtwinkle/feat/async-style-override
feat: async can style override
2 parents 5bbbbff + d48a293 commit b51ddfe

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

excelizeam.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@ type Excelizeam interface {
4040
// SetStyleCell Set style to cell
4141
SetStyleCell(colIndex, rowIndex int, style excelize.Style, override bool) error
4242
// SetStyleCellAsync Set style to cell asynchronously
43-
SetStyleCellAsync(colIndex, rowIndex int, style excelize.Style)
43+
SetStyleCellAsync(colIndex, rowIndex int, style excelize.Style, override bool)
4444

4545
// SetStyleCellRange Set style to cell with range
4646
SetStyleCellRange(startColIndex, startRowIndex, endColIndex, endRowIndex int, style excelize.Style, override bool) error
4747
// SetStyleCellRangeAsync Set style to cell with range asynchronously
48-
SetStyleCellRangeAsync(startColIndex, startRowIndex, endColIndex, endRowIndex int, style excelize.Style)
48+
SetStyleCellRangeAsync(startColIndex, startRowIndex, endColIndex, endRowIndex int, style excelize.Style, override bool)
4949

5050
// SetBorderRange Set border around cell range
5151
SetBorderRange(startColIndex, startRowIndex, endColIndex, endRowIndex int, borderRange BorderRange, override bool) error
5252
// SetBorderRangeAsync Set border around cell range asynchronously
53-
SetBorderRangeAsync(startColIndex, startRowIndex, endColIndex, endRowIndex int, borderRange BorderRange)
53+
SetBorderRangeAsync(startColIndex, startRowIndex, endColIndex, endRowIndex int, borderRange BorderRange, override bool)
5454

5555
// Wait
5656
// Wait for all running asynchronous operations to finish
@@ -228,9 +228,9 @@ func (e *excelizeam) setCellValue(colIndex, rowIndex int, value interface{}, sty
228228
return nil
229229
}
230230

231-
func (e *excelizeam) SetStyleCellAsync(colIndex, rowIndex int, style excelize.Style) {
231+
func (e *excelizeam) SetStyleCellAsync(colIndex, rowIndex int, style excelize.Style, override bool) {
232232
e.eg.Go(func() error {
233-
err := e.setStyleCell(colIndex, rowIndex, style, false)
233+
err := e.setStyleCell(colIndex, rowIndex, style, override)
234234
return err
235235
})
236236
}
@@ -271,9 +271,9 @@ func (e *excelizeam) setStyleCell(colIndex, rowIndex int, style excelize.Style,
271271
return nil
272272
}
273273

274-
func (e *excelizeam) SetStyleCellRangeAsync(startColIndex, startRowIndex, endColIndex, endRowIndex int, style excelize.Style) {
274+
func (e *excelizeam) SetStyleCellRangeAsync(startColIndex, startRowIndex, endColIndex, endRowIndex int, style excelize.Style, override bool) {
275275
e.eg.Go(func() error {
276-
err := e.setStyleCellRange(startColIndex, startRowIndex, endColIndex, endRowIndex, style, false)
276+
err := e.setStyleCellRange(startColIndex, startRowIndex, endColIndex, endRowIndex, style, override)
277277
return err
278278
})
279279
}
@@ -323,9 +323,9 @@ func (e *excelizeam) setStyleCellRange(startColIndex, startRowIndex, endColIndex
323323
return nil
324324
}
325325

326-
func (e *excelizeam) SetBorderRangeAsync(startColIndex, startRowIndex, endColIndex, endRowIndex int, borderRange BorderRange) {
326+
func (e *excelizeam) SetBorderRangeAsync(startColIndex, startRowIndex, endColIndex, endRowIndex int, borderRange BorderRange, override bool) {
327327
e.eg.Go(func() error {
328-
err := e.setBorderRange(startColIndex, startRowIndex, endColIndex, endRowIndex, borderRange, false)
328+
err := e.setBorderRange(startColIndex, startRowIndex, endColIndex, endRowIndex, borderRange, override)
329329
return err
330330
})
331331
}

excelizeam_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -508,14 +508,14 @@ func TestExcelizeam_Async(t *testing.T) {
508508
Left: &excelizeam.BorderItem{Style: excelizestyle.BorderStyleDash2, Color: excelizestyle.BorderColorBlack},
509509
Right: &excelizeam.BorderItem{Style: excelizestyle.BorderStyleDash2, Color: excelizestyle.BorderColorBlack},
510510
Inside: &excelizeam.BorderItem{Style: excelizestyle.BorderStyleDash2, Color: excelizestyle.BorderColorBlack},
511-
})
511+
}, false)
512512
w.SetBorderRangeAsync(6, 6, 10, 10, excelizeam.BorderRange{
513513
Top: &excelizeam.BorderItem{Style: excelizestyle.BorderStyleContinuous2, Color: excelizestyle.BorderColorBlack},
514514
Bottom: &excelizeam.BorderItem{Style: excelizestyle.BorderStyleContinuous2, Color: excelizestyle.BorderColorBlack},
515515
Left: &excelizeam.BorderItem{Style: excelizestyle.BorderStyleContinuous2, Color: excelizestyle.BorderColorBlack},
516516
Right: &excelizeam.BorderItem{Style: excelizestyle.BorderStyleContinuous2, Color: excelizestyle.BorderColorBlack},
517517
Inside: &excelizeam.BorderItem{Style: excelizestyle.BorderStyleContinuous2, Color: excelizestyle.BorderColorBlack},
518-
})
518+
}, false)
519519
},
520520
},
521521
"SetBorderRangeAsync-override_error": {
@@ -533,7 +533,7 @@ func TestExcelizeam_Async(t *testing.T) {
533533
Left: &excelizeam.BorderItem{Style: excelizestyle.BorderStyleContinuous2, Color: excelizestyle.BorderColorBlack},
534534
Right: &excelizeam.BorderItem{Style: excelizestyle.BorderStyleContinuous2, Color: excelizestyle.BorderColorBlack},
535535
Inside: &excelizeam.BorderItem{Style: excelizestyle.BorderStyleContinuous2, Color: excelizestyle.BorderColorBlack},
536-
})
536+
}, false)
537537
},
538538
wantErr: excelizeam.ErrOverrideCellStyle,
539539
},

0 commit comments

Comments
 (0)