Table of Contents

Method SetAutoFilter

Namespace
DocWright.Spreadsheet
Assembly
DocWright.Spreadsheet.dll

SetAutoFilter(XlsxCellRange?)

Gives the sheet an autofilter over a range, or takes it away: the arrows Excel's Data > Filter puts on the range's first row.

public void SetAutoFilter(XlsxCellRange? range)

Parameters

range XlsxCellRange?

The range, its first row the header; null takes the autofilter away.

Remarks

A sheet has one autofilter. Giving it another range, or taking it away, clears the criteria the old one had and shows every row they hid, as Excel does. The range is recorded as Excel records it, with the hidden name _xlnm._FilterDatabase.

Exceptions

ArgumentException

The range reaches outside the worksheet grid.

InvalidOperationException

The sheet is not a worksheet.

UnsupportedFeatureException

The range overlaps a table, which has an autofilter of its own.

InvalidDocumentException

A part of the workbook is malformed.