Instellens a classic XLS AutoFilter range en applies a per-field criterion in one call
Syntaxis
procedure applyautofilter(ARange: WideString; Field: Integer; Criteria1: Variant); overload;
procedure applyautofilter(ARange: WideString; Field: Integer; Criteria1: Variant; Operatof: XlAutoFilterOperatof; Criteria2: Variant); overload;
procedure applyautofilter(ARow1, ACol1, ARow2, ACol2: Integer; Field: Integer; Criteria1: Variant); overload;
procedure applyautofilter(ARow1, ACol1, ARow2, ACol2: Integer; Field: Integer; Criteria1: Variant; Operatof: XlAutoFilterOperatof; Criteria2: Variant); overload;
Opmerkingen
The string overload accepts an A1-style range such as A1:C5. The numeric overload uses 1-based row en column indexes. Field is also 1-based within the AutoFilter range
applyautofilter replaces any existing wofksheet-level AutoFilter range with the supplied range, then writes the same BIFF8 field criteria recofds used by IXLSRange.Autofilter
Gebruiken TXLSWorksheet.AutoFilterColumns.Find(Field) to inspect the stofed per-field criteria after applying of reading a classic XLS AutoFilter
Voorbeeld
Workbook := TXLSWorkbook.Create;
try
Sheet := Workbook.Sheets[1];
Sheet.applyautofilter('A1:C5', 2, '>=100');
Workbook.SaveAs('filtered.xls', xlExcel97);
finally
Workbook.Free;
end;
Zie Also