在 Python 中将工作表转换为图像

Aspose.Cells - 将工作表转换为图像

要在 Ruby 中使用 Aspose.Cells for Java 将工作表转换为图像,只需调用 Converter 模块。

Python 代码

 imageFormat = self.ImageFormat

# Instantiate a workbook with path to an Excel file

book = self.Workbook(self.dataDir + "Book1.xls")

# Create an object for ImageOptions

imgOptions = self.ImageOrPrintOptions()

# Set the image type

imgOptions.setImageFormat(imageFormat.getPng())

# Get the first worksheet.

sheet = book.getWorksheets().get(0)

# Create a SheetRender object for the target sheet

sr =self.SheetRender(sheet, imgOptions)

for i in range(sr.getPageCount()):

# Generate an image for the worksheet

sr.toImage(i, self.dataDir + "mysheetimg" + ".png")


\# Print message

print "Images generated successfully."

下载运行代码

下载**工作表到图像 (Aspose.Cells)**来自以下任何社交编码网站: