データのフィルタリング
Contents
[
Hide
]
Aspose.Cells.GridWeb は、自動フィルターおよびカスタム データ フィルター機能を提供します。これらの機能を使用すると、リストに表示するワークシート内の項目のみを選択できます。さらに、設定された基準に従ってリスト内のアイテムをフィルタリングできます。フィルタリング機能を使用して、テキスト、数値、または日付をフィルタリングします。
フィルターの操作
ワークシートの AddAutoFilter メソッドを使用して、ワークシートのオートフィルターを有効にします。このメソッドは、行、開始、および終了列のインデックスを受け入れます。
カスタム フィルターを有効にするには、ワークシートの AddCustomFilter メソッドを使用します。このメソッドは、フィルターを適用する必要がある行インデックスとカスタム フィルター条件を受け入れます。
以下の例では、自動データ フィルターとカスタム データ フィルターの両方を実装しています。この例では、自動フィルター機能が有効になっており、フィルター処理された行がいくつかの基準に基づいて検索されます。
入力: 最初のワークシートのデータ リスト
出力: 自動フィルター機能を有効にする
オートフィルター
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Access active worksheet | |
var sheet = GridWeb1.WorkSheets[this.GridWeb1.ActiveSheetIndex]; | |
// Enable GridWeb's auto-filter. | |
sheet.AddAutoFilter(0, 0, sheet.Cells.MaxDataColumn); | |
sheet.RefreshFilter(); |
カスタム データ フィルタ
基準に基づいてカスタム フィルター処理されたデータ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Access active worksheet | |
var sheet = GridWeb1.WorkSheets[this.GridWeb1.ActiveSheetIndex]; | |
// Enable GridWeb's custom-filter. | |
sheet.AddCustomFilter(1, "CELL0=\"1\""); | |
sheet.RefreshFilter(); |