ResimOluşturYazdırOptions ın PageIndex ve PageCount Özelliklerini Kullanarak Sayfaların Sıralı Olarak Görüntülenmesi

Olası Kullanım Senaryoları

Aspose.Cells for Python via .NET ile ImageOrPrintOptions.page_index ve ImageOrPrintOptions.page_count özelliklerini kullanarak Excel dosyanızın bir sayfa dizisini görselleştirebilirsiniz. Bu özellikler, çalışma sayfanızda binlerce sayfa olsa bile sadece bazılarını render etmek istediğinizde kullanışlıdır. Bu, işlem süresini ve render işleminin bellek tüketimini tasarruf edecektir.

Görüntü veya Yazdırma Seçenekleri Kullanılarak Sayfa Dizisi Oluşturma

Aşağıdaki örnek kod, ImageOrPrintOptions.page_index ve ImageOrPrintOptions.page_count özelliklerini kullanarak örnek Excel dosyasını yükler ve yalnızca 4, 5, 6 ve 7 sayfaları oluşturur. İşte kod tarafından oluşturulan sayfaların oluşturulmuş görüntüleri.

todo:image_alt_text todo:image_alt_text
todo:image_alt_text todo:image_alt_text

Örnek Kod

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
# Source directory
sourceDir = RunExamples.Get_SourceDirectory()
# Output directory
outputDir = RunExamples.Get_OutputDirectory()
# Load the sample Excel file
wb = Workbook(sourceDir + "sampleImageOrPrintOptions_PageIndexPageCount.xlsx")
# Access the first worksheet
ws = wb.worksheets[0]
# Specify image or print options
# We want to print pages 4, 5, 6, 7
opts = ImageOrPrintOptions()
opts.page_index = 3
opts.page_count = 4
opts.image_type = ImageType.PNG
# Create sheet render object
sr = SheetRender(ws, opts)
# Print all the pages as images
for i in range(opts.page_index, sr.page_count):
sr.to_image(i, outputDir + "outputImage-" + str(i + 1) + ".png")