Converting Excel to PNG in Windows and Linux

Hi, I am using Aspose.cell (version: 19.12) to operate excel to snip the specified area and generate a picture. The picture can be generated normally in Windows, but it is blank when generated in Linux.

How can I generate the picture correctly in Linux environment? Please see attached code for reference. Thanks.
Excel to PNG Sample.zip (83.4 KB)

@fryan,
I have tried this scenario in Linux environment but could not observe the issue. I found a little issue in the code mentioned below:

String sheetName="Output";

I got the blank image of 0 bytes however if we check the sheet name it contains a space after the sheet name so above line of code was changed as follows:

String sheetName="Output ";//Notice the space at the end of sheet name

After this change when I executed code, I got proper image. Could you please give it a try and share the feedback.

Hi @ahsaniqbalsidiqui

Thanks for your help. I could get the image with the same Excel template in Windows so I assume it’s not the sheet name issue.

When I try it in Linux, I can get a png file with 10Mb in size, but it is blank when I open it. Not sure what the problem is.

What is the version you used? Could it be version issue?

Thanks

@fryan,
Following is the OS version detail where image is created successfully. You may please try with some other sample Excel file as well and share the feedback.

NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

@fryan,
You may please try to convert the excel file to PDF in both the environments i.e. Windows and Linux and share the output files with us for our analysis.

Although title of your post is Excel to PNG but your sample code is converting to JPEG type image. You may please try using following line of code and test the scenario again.

options.setImageType(ImageType.JPEG);