スライサーの削除
Contents
[
Hide
]
可能な使用シナリオ
Microsoft Excelでスライサーを削除するには、それを選択し、削除ボタンを押してください。同様に、Aspose.Cells APIを使用してそれを削除する場合は、Worksheet.getSlicers().remove()メソッドを使用してください。
スライサーの削除
次のサンプルコードは、既存のスライサーが含まれるsample Excel fileをロードし、スライサーにアクセスしてからそれを削除します。最後に、ワークブックをoutput Excel fileとして保存します。スクリーンショットは、サンプルコードの実行後に削除されるスライサーを示しています。
サンプルコード
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-Java | |
// Load sample Excel file containing slicer. | |
Workbook wb = new Workbook(srcDir + "sampleRemovingSlicer.xlsx"); | |
// Access first worksheet. | |
Worksheet ws = wb.getWorksheets().get(0); | |
// Access the first slicer inside the slicer collection. | |
Slicer slicer = ws.getSlicers().get(0); | |
// Remove slicer. | |
ws.getSlicers().remove(slicer); | |
// Save the workbook in output XLSX format. | |
wb.save(outDir + "outputRemovingSlicer.xlsx", SaveFormat.XLSX); |