データのフィルタリング
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(); |