スライサープロパティを変更する
Contents
[
Hide
]
可能な使用シナリオ
配置や行の高さなど、スライサのプロパティを変更したい場合があります。Aspose.Cells for Python via .NETでは、これらのプロパティを更新するオプションが提供されます。
Aspose.Cells for Python Excelライブラリを使用したスライサのプロパティの変更方法
次のサンプルコードをご覧ください。最初の列を含むサンプルExcelファイルを読み込み、その後、高さ、幅、印刷可能、タイトルなどのプロパティを変更したスライサーを作成します。ワークブックをoutputChangeSlicerProperties.xlsxとして保存します。
サンプルコード
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
from aspose.cells import SaveFormat, Workbook | |
from aspose.cells.drawing import PlacementType | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# Load sample Excel file containing a table. | |
workbook = Workbook(sourceDir + "sampleCreateSlicerToExcelTable.xlsx") | |
# Access first worksheet. | |
worksheet = workbook.worksheets[0] | |
# Access first table inside the worksheet. | |
table = worksheet.list_objects[0] | |
# Add slicer | |
idx = worksheet.slicers.add(table, 0, "H5") | |
slicer = worksheet.slicers[idx] | |
slicer.placement = PlacementType.FREE_FLOATING | |
slicer.row_height_pixel = 50 | |
slicer.width_pixel = 500 | |
slicer.title = "Aspose" | |
slicer.alternative_text = "Alternate Text" | |
slicer.is_printable = False | |
slicer.is_locked = False | |
# Refresh the slicer. | |
slicer.refresh() | |
# Save the workbook in output XLSX format. | |
workbook.save(outputDir + "outputChangeSlicerProperties.xlsx", SaveFormat.XLSX) |