6

I just started working with the Aspose.Cell's library for .NET and am having some issues finding documentation on how to enable Data Filtering for an output Excel sheet.

I understand this functionality is built into Aspose.Cells.GridWeb and documented here (http://www.aspose.com/docs/display/cellsnet/Data+Filtering) however I cannot use this namespace to produce a document with this filtering enabled.

Is this functionality just not possible through the use of Aspose?

arserbin3
  • 6,010
  • 8
  • 36
  • 52
JeffreDodd
  • 244
  • 5
  • 12

2 Answers2

9

Aspose provides this functionality through the Aspose.Cells.AutoFilter object.

The documentation can be found here: https://apireference.aspose.com/net/cells/aspose.cells/autofilter

And some examples can be found here: https://docs.aspose.com/display/cellsnet/Data+Filtering

To add autofilter to a heading row:

//Creating AutoFilter by giving the cells range of the heading row
worksheet.AutoFilter.Range = "A1:B1";
Jonathan Sayce
  • 9,359
  • 5
  • 37
  • 51
Ted A.
  • 2,264
  • 17
  • 22
0

I set AutoFilter on the first row this way:

var idxLastColumn = worksheet.Cells.MaxDataColumn;
var firstRowLastCellName = CellsHelper.CellIndexToName(1, idxLastColumn);
worksheet.AutoFilter.Range = $"A1:{firstRowLastCellName}";

See https://docs.aspose.com/cells/net/data-filtering/#autofilter-with-asposecells

vvvvv
  • 25,404
  • 19
  • 49
  • 81
mortenma71
  • 1,078
  • 2
  • 9
  • 27