We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Install Aspose.Cells Java for Python to Convert Excel Worksheets into Image Files

I am trying to setup Aspose.Cells Java for Python so I can convert excel worksheets into image files.
As needed, I have installed Jpype onto my Mac, and have moved on to installing Aposte.Cells for Java. I have the file ‘aspose-cells-17.7-java.zip’, but when I try to unzip it just creates a new zipped file, and when I try to unzip that, it creates another zip file. I have an endless loop of zips!
If anyone could be of any help in solving this issue it would be much appreciated. I only found out about this software about 30mins ago and frankly have no idea what I’m doing.

mr boiddims


There is no endless loop if zips. Actually Aspose.Cells for Java does provide spreadsheet management/conversion library and a separate grid control (Aspose.Cells.GridWeb (JAVA)). Moreover, zipped archive also includes HTML API reference documentation, text files and some other resource files for both Aspose.Cells library and JSP/Servlets based Grid control.
I have pasted the complete details with screenshots for aspose-cells-17.7-java.zip release archive for your requirements:
The release archive “aspose-cells-17.7-java.zip” is extracted into two files:

JDK 1.6 folder contains two zipped files:

Please open internal “aspose-cells-17.7-java” zipped file that contains the following folders:

lib folder contains Aspose.Cells for Java component’s JAR files which you should use:

Hope it helps a bit.

Thank you.

Thanks for your help!

What exactly do I do with the Jar file now?

I found it! I put the two jar files in /Applications/lib, but for some reason when I run my code I still get the error:

You need to put your Aspose.Cells for Java APIs .jars in this folder:

I don’t think that is an error, I think it just displays ever time.
However, nothing happens. I am running the code to convert Excel sheet --> image but nothing is happening.


Could you paste the sample code here. Also, we recommend you to kindly see the document for your reference on how to convert an Excel sheet to image file in JAVA:

Also, you may browse different topics/examples for your reference on configuring and using Aspose.Cells in Python:

Thank you.

Again thanks for your help.
I am running the code given in the demo I downloaded from Github.

I combined the init.py and main .py file together as I was getting an error about the init file not being imported correctly.

import jpype
import os.path

class WorksheetToImage:

def __init__(self,dataDir):
    self.dataDir = dataDir
    self.Workbook = jpype.JClass("com.aspose.cells.Workbook")
    self.ImageFormat = jpype.JClass("com.aspose.cells.ImageFormat")
    self.ImageOrPrintOptions = jpype.JClass("com.aspose.cells.ImageOrPrintOptions")
    self.SheetRender = jpype.JClass("com.aspose.cells.SheetRender")

def main(self):

    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

    #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."

asposeapispath = os.path.join(os.path.abspath("../../../"), "lib/")
dataDir = os.path.join(os.path.abspath("./"), "data/")

print "You need to put your Aspose.Cells for Java APIs .jars in this folder:\n"+asposeapispath

#print dataDir
jpype.startJVM(jpype.getDefaultJVMPath(), "-Djava.ext.dirs=%s" % asposeapispath)

hw = WorksheetToImage(dataDir)

When I run this code, it just returns

You need to put your Aspose.Cells for Java APIs .jars in this folder:

and nothing else happens.

If I run the python file of any of the examples, it gives me an error such as “ImportError: No module named quickstart” (for the HelloWorld) example. For some reason I can’t import the init file


You meant the image (for the sheet) is not generated in the specified folder. I am not sure if the issue is related to Aspose.Cells for Java but the issue can be related to configurations, etc. You may take some help browsing internet. For example, see the documents/threads for your reference:

Thank you.