Spire.XLS is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application and Java (J2SE and J2EE) application.

Thu Apr 08, 2021 5:47 am

Hi

I'm using FREE Spire.XLS for Java library for XLS to image.

when i tested with excel file include 12 columns X 100 rows, I got Exeption(Size of image is too large.) that try to make 600dpi image.

and when I try to convert excel to image with more rows, image has worse quality.

so I guess this library has limit about memory size or pixel count when convert image.

is it right? if right, how to increase limit memory size or pixel count when convert xlsx to image?

or if i buy commercial licence, i will get better quality image?

ccame8539
 
Posts: 7
Joined: Tue Apr 06, 2021 7:01 am

Thu Apr 08, 2021 8:48 am

Hello,

Thanks for your inquiry.
Our Spire.XLS provides the following method to set the DPI for image which can improve the quality of images. Please have a try.
Code: Select all
 
        //Set dpi on x and y axis
        wb.getConverterSetting().setXDpi(300);
        wb.getConverterSetting().setYDpi(300);

Our Spire.XLS has no limitation on memory size. Did you mean that the image size is too large after converting Excel to image? Actually, the DPI of generated image is 96 by default. The larger the DPI, the larger the image size.
In addition, I would suggest that your evaluate our commercial version (Spire.XLS for Java Version:4.3.4) since it is more stable and contains more feature than free version.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 230
Joined: Wed Apr 07, 2021 2:50 am

Thu Apr 08, 2021 9:07 am

thanks to reply.

but I already try that code:(

in my eyes, there is no special difference between 100DPI and 300DPI.

I think image quality more depend on how many cell in excel likley.

ccame8539
 
Posts: 7
Joined: Tue Apr 06, 2021 7:01 am

Thu Apr 08, 2021 10:44 am

Hi,

Thanks for your prompt reply.
Setting 300 dpi has higher quality than 100 dpi. To verify it, I did a test and zoom both images in the same scale. See the attach screenshot for the difference.

Sincerely
Annika
E-iceblue support team
Attachments
test.zip
(67.16 KiB) Downloaded 38 times
User avatar

Annika.Zhou
 
Posts: 230
Joined: Wed Apr 07, 2021 2:50 am

Thu Apr 08, 2021 3:25 pm

thanks for test!!

but still I cannot realize difference with zoom 200%, 300% between 100dpi and 300dpi at generated by me.

please check attached.

and here is my test code.

i tested this code on spring boot 2 and centos7 docker.

Code: Select all

    implementation 'e-iceblue:spire.xls.free:3.9.2'

    public void convertXlsmToPNG(String fileName, int dpi) throws IOException {
        Workbook workbook = new Workbook();
        try {
            workbook.loadFromFile(INPUT_DIR + fileName);

            workbook.getConverterSetting().setXDpi(dpi);
            workbook.getConverterSetting().setYDpi(dpi);

            Worksheet worksheet = workbook.getWorksheets().get(0);

            //Set the margin as 0 to remove the white space around the image
            worksheet.getPageSetup().setLeftMargin(0);
            worksheet.getPageSetup().setTopMargin(0);
            worksheet.getPageSetup().setRightMargin(0);
            worksheet.getPageSetup().setBottomMargin(0);

            //Save the sheet to image
            BufferedImage bufferedImage = worksheet.toImage(
                worksheet.getFirstRow(), worksheet.getFirstColumn(), 100, 12);
            ImageIO.write(bufferedImage,"PNG",new File(OUTPUT_DIR + fileName + "." + dpi + "dpi.png"));
}

Attachments
test.100dpi.300dpi.zoom.zip
(115.3 KiB) Downloaded 45 times

ccame8539
 
Posts: 7
Joined: Tue Apr 06, 2021 7:01 am

Fri Apr 09, 2021 9:19 am

Hello,

Thank you for your feedback.
I have noticed that the pictures you provided are rather blurry (low quality). Since you did not provide your input Excel, I have simulated one for verification, and there are obvious differences when comparing them respectively in a certain scale. In your code, you converted sheet including more data (100 rows and 12 columns) to image. Generally, if the image has more data, it really looks blurry at a small scale. You can zoom in the image more (such as 500%+) and you should see a noticeable difference. In addition, we suggest that you download our latest version (Spire.XLS for Java Version:4.3.4 ) for verification first. If the issue still happens, please provide your input Excel and the pictures you generated for a better investigation.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 230
Joined: Wed Apr 07, 2021 2:50 am

Fri Apr 09, 2021 9:41 am

thanks for review!

my previous attached image just zoom and take screenshot, so it has same quality image made by my code.

and when i try to make image with [Spire.XLS for Java Version:4.3.4], the image not has included image in excel and no japanese characters:(

thanks for your kind support, but this library is not working as my expected to make prototype program.

ccame8539
 
Posts: 7
Joined: Tue Apr 06, 2021 7:01 am

Fri Apr 09, 2021 10:25 am

Hi,

Did you mean that the japanese characters in your Excel lost after converting to image using the latest Spire.XLS? If so, please make sure that your testing environment contains the japanese fonts that supports rendering the japanese characters. I suggest that you copy the fonts used in your Excel in your dockfile while testing in Docker. If there is still the question, please provide your Excel file and your generated pictures to help us further look into your issue, you could attach them here or send then to us via email(support@e-iceblue.com). Thanks in advance.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 230
Joined: Wed Apr 07, 2021 2:50 am

Fri Apr 09, 2021 10:52 am

Of course already installed japanese font in docker.

when I try with e-iceblue:spire.xls.free:3.9.2, no issue about japanese character.

ccame8539
 
Posts: 7
Joined: Tue Apr 06, 2021 7:01 am

Mon Apr 12, 2021 1:44 pm

Hi,

Thanks for your feedback and sorry for the late reply as weekend.
I made a sample Excel file with japanese characters and tested it on Centos7 docker using our Spire.XLS 4.3.4, but didn't encounter the issue you mentioned. Here I uploaded my testing files (including my dockerfile, executable jar as well as input Excel file) for your reference. I suggest that you copy the font that your japanese characters used to your docker and try again. If this doesn't help, please provide your input Excel file for a better investigation. I am looking forward to your reply.
http://www.e-iceblue.com/downloads/attachment/MyTest.zip

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 230
Joined: Wed Apr 07, 2021 2:50 am

Wed Apr 14, 2021 10:45 am

Hello,

Greetings from e-iceblue.
How is your issue going? Can you give us some feedback at your convenience?

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 230
Joined: Wed Apr 07, 2021 2:50 am

Mon Apr 19, 2021 10:46 am

Hi

just i opened your docker, but, i have question about the MS font, is it open and use freely?

anyway, I cannot make image use Spire.XLS 4.3.4 as previously reply.

so i will use spire.xls.free:3.9.2 for make image that split excel sheet by constant row count.

after that i will make one image from splited images.

this process make better quality for text.

thanks your help and this library awesome:)

ccame8539
 
Posts: 7
Joined: Tue Apr 06, 2021 7:01 am

Tue Apr 20, 2021 10:02 am

Hello,

Thank you for your feedback.
As far as I know, the MS font needs authorization for commercial use, maybe you could contact support of MS offical for an accurate response.
Glad to hear that our Free Spire.XLS could meet your requirment well. If you encounter other problems in the future, please feel free to contact us.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 230
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.XLS