@@ -799,34 +799,25 @@ func TestAutoFilter(t *testing.T) {
799
799
if err != nil {
800
800
t .Error (err )
801
801
}
802
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `` )
803
- t .Log (err )
804
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"B","expression":"x != blanks"}` )
805
- t .Log (err )
806
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"B","expression":"x == blanks"}` )
807
- t .Log (err )
808
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"B","expression":"x != nonblanks"}` )
809
- t .Log (err )
810
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"B","expression":"x == nonblanks"}` )
811
- t .Log (err )
812
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"B","expression":"x <= 1 and x >= 2"}` )
813
- t .Log (err )
814
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"B","expression":"x == 1 or x == 2"}` )
815
- t .Log (err )
816
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"B","expression":"x == 1 or x == 2*"}` )
817
- t .Log (err )
818
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"B","expression":"x <= 1 and x >= blanks"}` )
819
- t .Log (err )
820
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"B","expression":"x -- y or x == *2*"}` )
821
- t .Log (err )
822
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"B","expression":"x != y or x ? *2"}` )
823
- t .Log (err )
824
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"B","expression":"x -- y o r x == *2"}` )
825
- t .Log (err )
826
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"B","expression":"x -- y"}` )
827
- t .Log (err )
828
- err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , `{"column":"A","expression":"x -- y"}` )
829
- t .Log (err )
802
+ formats := []string {`` ,
803
+ `{"column":"B","expression":"x != blanks"}` ,
804
+ `{"column":"B","expression":"x == blanks"}` ,
805
+ `{"column":"B","expression":"x != nonblanks"}` ,
806
+ `{"column":"B","expression":"x == nonblanks"}` ,
807
+ `{"column":"B","expression":"x <= 1 and x >= 2"}` ,
808
+ `{"column":"B","expression":"x == 1 or x == 2"}` ,
809
+ `{"column":"B","expression":"x == 1 or x == 2*"}` ,
810
+ `{"column":"B","expression":"x <= 1 and x >= blanks"}` ,
811
+ `{"column":"B","expression":"x -- y or x == *2*"}` ,
812
+ `{"column":"B","expression":"x != y or x ? *2"}` ,
813
+ `{"column":"B","expression":"x -- y o r x == *2"}` ,
814
+ `{"column":"B","expression":"x -- y"}` ,
815
+ `{"column":"A","expression":"x -- y"}` ,
816
+ }
817
+ for _ , format := range formats {
818
+ err = xlsx .AutoFilter ("Sheet3" , "D4" , "B1" , format )
819
+ t .Log (err )
820
+ }
830
821
err = xlsx .Save ()
831
822
if err != nil {
832
823
t .Error (err )
@@ -1103,6 +1094,29 @@ func TestRows(t *testing.T) {
1103
1094
}
1104
1095
}
1105
1096
1097
+ func TestOutlineLevel (t * testing.T ) {
1098
+ xlsx := NewFile ()
1099
+ xlsx .NewSheet ("Sheet2" )
1100
+ xlsx .SetColOutlineLevel ("Sheet1" , "D" , 4 )
1101
+ xlsx .GetColOutlineLevel ("Sheet1" , "D" )
1102
+ xlsx .GetColOutlineLevel ("Shee2" , "A" )
1103
+ xlsx .SetColWidth ("Sheet2" , "A" , "D" , 13 )
1104
+ xlsx .SetColOutlineLevel ("Sheet2" , "B" , 2 )
1105
+ xlsx .SetRowOutlineLevel ("Sheet1" , 2 , 1 )
1106
+ xlsx .GetRowOutlineLevel ("Sheet1" , 2 )
1107
+ err := xlsx .SaveAs ("./test/Book_outline_level.xlsx" )
1108
+ if err != nil {
1109
+ t .Error (err )
1110
+ return
1111
+ }
1112
+ xlsx , err = OpenFile ("./test/Book1.xlsx" )
1113
+ if err != nil {
1114
+ t .Error (err )
1115
+ return
1116
+ }
1117
+ xlsx .SetColOutlineLevel ("Sheet2" , "B" , 2 )
1118
+ }
1119
+
1106
1120
func trimSliceSpace (s []string ) []string {
1107
1121
for {
1108
1122
if len (s ) > 0 && s [len (s )- 1 ] == "" {
0 commit comments