HotXLS-dokumentation Innehåll Startsida Översikt TGridToXLS IXLSWorkbook Startsida Innehåll Översikt

ApplyAutoFilter metod

Sets a classic XLS AutoFilter range and applies a per-field criterion in one call

Syntax

procedure ApplyAutoFilter(ARange: WideString; Field: Integer; Criteria1: Variant); overload; procedure ApplyAutoFilter(ARange: WideString; Field: Integer; Criteria1: Variant; Operator: XlAutoFilterOperator; 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; Operator: XlAutoFilterOperator; Criteria2: Variant); overload;

Anmärkningar

The string overload accepts an A1-style range such as A1:C5. The numeric overload uses 1-based row and column indexes. Field is also 1-based within the AutoFilter range ApplyAutoFilter replaces any existing worksheet-level AutoFilter range with the supplied range, then writes the same BIFF8 field criteria records used by IXLSRange.Autofilter Use TXLSWorksheet.AutoFilterColumns.Find(Field) to inspect the stored per-field criteria after applying or reading a classic XLS AutoFilter

Exempel

Workbook := TXLSWorkbook.Create; try Sheet := Workbook.Sheets[1]; Sheet.ApplyAutoFilter('A1:C5', 2, '>=100'); Workbook.SaveAs('filtered.xls', xlExcel97); finally Workbook.Free; end;

See Also

TXLSWorksheet.SetAutoFiltermetod
TXLSWorksheet.AutoFilterColumnsegenskap
TXLSWorksheet.AutoFilterRangeegenskap
TXLSWorksheet.ClearAutoFiltermetod
IXLSRange.Autofiltermetod
klass TXLSWorksheet Copyright © 2010-2026 losLab Software