共用方式為


Worksheet.AutoFilterMode Property

Gets or sets a value that indicates whether filtering is currently enabled on the worksheet (that is, whether the filter drop-down arrows are currently displayed).

Namespace:  Microsoft.Office.Tools.Excel
Assemblies:   Microsoft.Office.Tools.Excel (in Microsoft.Office.Tools.Excel.dll)
  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
Property AutoFilterMode As Boolean
bool AutoFilterMode { get; set; }

Property Value

Type: System.Boolean
true if filtering is currently enabled on the worksheet; otherwise, false.

Exceptions

Exception Condition
COMException

This property is set to true.

Remarks

You can set this property to false to disable filtering (that is, to remove the filter drop-down arrows), but you cannot set it to true. To enable filtering and create a filtered list, use the AutoFilter method of a Range object, or use the AutoFilter method of a NamedRange object.

This property indicates only whether filtering is enabled; it does not indicate whether any data is being filtered. To determine whether the worksheet is actively filtering data, use the FilterMode property.

.NET Framework Security

See Also

Reference

Worksheet Interface

Microsoft.Office.Tools.Excel Namespace