在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)