スライサーのレンダリング
Contents
[
Hide
]
スライサーのレンダリング
Aspose.Cells for Python via Java は、スライサー形状のレンダリングをサポートしています。次のコードスニペットは、スライサーを含むsample Excel fileをロードし、スライサーのみをカバーする印刷エリアを設定してワークシートを画像に変換します。生成された画像は、レンダリングされたスライサーを示すoutput imageです。スライサーが正しくレンダリングされており、サンプル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
import jpype | |
import asposecells | |
jpype.startJVM() | |
from asposecells.api import Workbook, SaveFormat, ImageOrPrintOptions, ImageType, SheetRender | |
# Load Source Excel file | |
workbook = Workbook("sampleRenderingSlicer.xlsx") | |
# Access first worksheet | |
worksheet = workbook.getWorksheets().get(0) | |
# Set the print area because we want to render slicer only | |
worksheet.getPageSetup().setPrintArea("B15:E25") | |
# Specify image or print options, set one page per sheet and only area to true | |
imgOpts = ImageOrPrintOptions() | |
imgOpts.setHorizontalResolution(200) | |
imgOpts.setVerticalResolution(200) | |
imgOpts.setImageType(ImageType.PNG) | |
imgOpts.setOnePagePerSheet(True) | |
imgOpts.setOnlyArea(True) | |
# Create sheet render object and render worksheet to image | |
sheetrender = SheetRender(worksheet, imgOpts) | |
sheetrender.toImage(0, "outputRenderingSlicer.png") | |
jpype.shutdownJVM() |