スライサーのレンダリング
Contents
[
Hide
]
可能な使用シナリオ
Aspose.Cells for Python via .NETは、スライサーの形状のレンダリングをサポートしています。ワークシートを画像に変換したり、ワークブックをPDFやHTML形式に保存すると、スライサーが適切にレンダリングされます。
Aspose.Cells for Python Excel Libraryを使用したスライサーのレンダリング方法
次のサンプルコードは、既存のスライサーを含む サンプルExcelファイル を読み込みます。それからスライサーのみをカバーする印刷範囲を設定してワークシートを画像に変換します。生成された出力イメージは、正しくレンダリングされたスライサーを示しています。
サンプルコード
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 Workbook | |
from aspose.cells.drawing import ImageType | |
from aspose.cells.rendering import ImageOrPrintOptions, SheetRender | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# Load sample Excel file containing slicer. | |
wb = Workbook("sampleRenderingSlicer.xlsx") | |
# Access first worksheet. | |
ws = wb.worksheets[0] | |
# Set the print area because we want to render slicer only. | |
ws.page_setup.print_area = "B15:E25" | |
# Specify image or print options, set one page per sheet and only area to true. | |
imgOpts = ImageOrPrintOptions() | |
imgOpts.horizontal_resolution = 200 | |
imgOpts.vertical_resolution = 200 | |
imgOpts.image_type = ImageType.PNG | |
imgOpts.one_page_per_sheet = True | |
imgOpts.only_area = True | |
# Create sheet render object and render worksheet to image. | |
sr = SheetRender(ws, imgOpts) | |
sr.to_image(0, "outputRenderingSlicer.png") |