horizontal_resolution属性

horizontal_resolution属性

获取或设置生成图像的水平分辨率(以每英寸点数为单位)。

注意事项

默认值为 96。

设置 ImageOrPrintOptions.horizontal_resolutionImageOrPrintOptions.vertical_resolution 影响输出图像的宽度和高度(以像素为单位)。

例子

以下代码将分辨率设置为192,生成的图像的宽度和高度是 分辨率保留为默认值 96。

from aspose.cells import Workbook
from aspose.cells.drawing import ImageType
from aspose.cells.rendering import ImageOrPrintOptions, SheetRender

wb = Workbook("Book1.xlsx")
opts = ImageOrPrintOptions()
# Set output image type: png.
opts.image_type = ImageType.PNG
# Set resolution to 192.
opts.horizontal_resolution = 192
opts.vertical_resolution = 192
# Render worksheet page to image.
sr = SheetRender(wb.worksheets[0], opts)
sr.to_image(0, "Sheet_Page1.png")

定义:

@property
def horizontal_resolution(self):
    ...
@horizontal_resolution.setter
def horizontal_resolution(self, value):
    ...

也可以看看