From 77af25295ece8863326c99652d615f82385286b2 Mon Sep 17 00:00:00 2001 From: Ri Xu Date: Fri, 18 Aug 2017 20:55:27 +0800 Subject: - Conditional format with formula support, relate issue #75; - go test and readme update --- excelize_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'excelize_test.go') diff --git a/excelize_test.go b/excelize_test.go index f4a0774..b075cd0 100644 --- a/excelize_test.go +++ b/excelize_test.go @@ -900,7 +900,7 @@ func TestRemoveRow(t *testing.T) { func TestConditionalFormat(t *testing.T) { xlsx := NewFile() for j := 1; j <= 10; j++ { - for i := 0; i <= 10; i++ { + for i := 0; i <= 15; i++ { xlsx.SetCellInt("Sheet1", ToAlphaString(i)+strconv.Itoa(j), j) } } @@ -937,6 +937,8 @@ func TestConditionalFormat(t *testing.T) { xlsx.SetConditionalFormat("Sheet1", "J1:J10", fmt.Sprintf(`[{"type":"average","criteria":"=","format":%d, "above_average": false}]`, format1)) // Data Bars: Gradient Fill. xlsx.SetConditionalFormat("Sheet1", "K1:K10", `[{"type":"data_bar", "criteria":"=", "min_type":"min","max_type":"max","bar_color":"#638EC6"}]`) + // Use a formula to determine which cells to format. + xlsx.SetConditionalFormat("Sheet1", "L1:L10", fmt.Sprintf(`[{"type":"formula", "criteria":"L2<3", "format":%d}]`, format1)) err = xlsx.SaveAs("./test/Workbook_conditional_format.xlsx") if err != nil { t.Log(err) -- cgit v1.2.1