Arbeitsblatt zu Bild Festlegen des Pixelformats für das gerenderte Bild

Contents
[ ]

Bitte beachten Sie den unten stehenden Beispielcode, der zeigt, wie das gewünschte Pixelformat beim Rendern von Blättern festgelegt wird.

from aspose.cells import Workbook
from aspose.cells.drawing import ImageType
from aspose.cells.rendering import ImageOrPrintOptions, SheetRender
from aspose.pydrawing.imaging import PixelFormat
# 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 an Excel file
wb = Workbook(sourceDir + "sampleSetPixelFormatRenderedImage.xlsx")
# Access first worksheet
ws = wb.worksheets[0]
# Set the ImageOrPrintOptions with desired pixel format (24 bits per pixel) and image format type
opts = ImageOrPrintOptions()
opts.pixel_format = PixelFormat.FORMAT_24BPP_RGB
opts.image_type = ImageType.TIFF
# Instantiate SheetRender object based on the first worksheet
sr = SheetRender(ws, opts)
# Save the image (first page of the sheet) with the specified options
sr.to_image(0, outputDir + "outputSetPixelFormatRenderedImage.tiff")