Microsoft Excel の高度なフィルターを適用して、複雑な基準を満たすレコードを表示する
Contents
[
Hide
]
考えられる使用シナリオ
Microsoft エクセルで申し込めます高度なフィルター複雑な基準を満たすレコードを表示するには、ワークシート データを使用します。高度なフィルターを Microsoft Excel で適用できます。データ > 詳細このスクリーンショットに示すようにコマンドを実行します。
Aspose.Cells を使用して高度なフィルターを適用することもできますWorksheet.AdvancedFilter()方法。 Microsoft Excel と同様に、次のパラメーターを受け入れます。
isFilter
リストを適切にフィルタリングするかどうかを示します。
リスト範囲
リスト範囲。
基準範囲
基準範囲。
コピー先
データのコピー先の範囲。
uniqueRecordOnly
一意の行のみを表示またはコピーします。
Microsoft Excel の高度なフィルターを適用して、複雑な基準を満たすレコードを表示する
次のサンプル コードは、高度なフィルタをサンプル Excel ファイルを生成し、出力 Excel ファイル.スクリーンショットは、比較のために両方のファイルを示しています。スクリーンショットでわかるように、データは複雑な条件に従って出力 Excel ファイル内でフィルター処理されています。
サンプルコード
This file contains hidden or 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 | |
//Load your source workbook | |
Workbook wb = new Workbook(sourceDir + "sampleAdvancedFilter.xlsx"); | |
//Access first worksheet | |
Worksheet ws = wb.Worksheets[0]; | |
//Apply advanced filter on range A5:D19 and criteria range is A1:D2 | |
//Besides, we want to filter in place | |
//And, we want all filtered records not just unique records | |
ws.AdvancedFilter(true, "A5:D19", "A1:D2", "", false); | |
//Save the workbook in xlsx format | |
wb.Save(outputDir + "outputAdvancedFilter.xlsx", SaveFormat.Xlsx); |