Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Wed Dec 21, 2022 2:11 pm

Hello,
I'm converting XLSX file into PDF file using spire.office-7.12.2 API.
The attached sample file "1. JLA_Debt Financials_Monthly_Actuals.xlsx" is taking too long to convert into pdf file. It really took more than 40 minutes to complete the process. But the file size is less than 1MB.

The sample source code is attached for your reference.
I appreciate your help.

MuchExecTime.zip
(829.5 KiB) Downloaded 169 times

UshaThavasiappan
 
Posts: 109
Joined: Sat Oct 08, 2022 9:23 am

Thu Dec 22, 2022 3:49 am

Hi,

Thanks for your inquiry.
I created a Java project and did some tests with the code and file you provided. My test environment is Windows 10 64bit, i5-7500, 16G memory, it took 19 minutes and 12 seconds to convert for the first time, the second time, it cost 19 minutes and 37 seconds. I have logged the issue into our issue tracking system with the ticket number SPIREXLS-4366. Our developers will do a detailed investigation to see if we can do performance optimization for your document. Once there is any good news, I will keep you informed.

Sincerely,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 999
Joined: Tue Nov 15, 2022 3:59 am

Thu Dec 22, 2022 4:17 am

Hello,

Thanks for taking it as a bug. I appreciate it.

UshaThavasiappan
 
Posts: 109
Joined: Sat Oct 08, 2022 9:23 am

Fri Dec 23, 2022 6:59 am

Hi,

According to our developers’ feedback, you need to adjust your code at line 64,
Code: Select all
 CellStyle style = worksheet.getColumns()[col-1].getCellStyle();

This code will set style for every cell and generate a lot of objects, which slows down the speed of converting.
Please replace the former code with the following, after my tests, it cost about 14 seconds to convert in total. You can modify your code and have a test.
Code: Select all
CellStyle style = worksheet.getDefaultColumnStyle(col);

If you have any further questions, just feel free to contact us.
Have a nice day! :D

Sincerely,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 999
Joined: Tue Nov 15, 2022 3:59 am

Fri Dec 23, 2022 1:46 pm

Hello Triste,

Thanks for your response.
Actually the solution was suggested by Abel in the discussion named "XLSX to PDF - Age calculation and Date format issue".

I will try your suggestion, but I have to test with all the files from the beginning whether it may create an issue or reopen an existing one.

Update : I tried to convert my all files, Im getting
java.lang.IllegalArgumentException: Invalid row index.
error for 5 files. But if I use this code
Code: Select all
CellStyle style = worksheet.getColumns()[col-1].getCellStyle();
, I got the same issue only for 2 files which I shared in the mentioned discussion.

UshaThavasiappan
 
Posts: 109
Joined: Sat Oct 08, 2022 9:23 am

Mon Dec 26, 2022 6:02 am

Hi,

Thanks for your feedback.
I have downloaded your files from post “XLSX to PDF - Age calculation and Date format issue”, I used the code “CellStyle style = worksheet.getDefaultColumnStyle(col)", after testing, I found the files (financial_statements_sample.xlsx, sales-forecast.xlsx) had the “Invalid row index” issue, the left 3 files (rieter-review-2017-2021-en.xlsx, Financial-statements-template.xlsx and hockeyplayerdata2018.xlsx) were converted successfully , this issue has been logged by Abel as SPIREXLS-4348. I glad to tell you that it has been solved now. I will inform you when new version is released.

Sincerely,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 999
Joined: Tue Nov 15, 2022 3:59 am

Mon Dec 26, 2022 9:05 am

Hi,
Yes, Abel logged a bug in the system. But when I use your suggestion, I got the same issue for 3 more files.
Ok, I will wait for the latest release and I check with my all files whether I face this issue or not.

UshaThavasiappan
 
Posts: 109
Joined: Sat Oct 08, 2022 9:23 am

Tue Dec 27, 2022 6:06 am

Hi,
 
Thanks for your feedback.
I tested your files with the code I suggested, the JDK version is 1.8.0_101, you can see the picture below, only 2 files will throw exception.
result.png
result.png (64.84 KiB) Viewed 1872 times

Attached is my project file, you can download it and have a test.
Once the new version is released, I will inform you in time. If you have other questions, just feel free to contact us.
 
Sincerely,
Triste
E-iceblue support team
Attachments
Office.rar
(631.06 KiB) Downloaded 164 times
User avatar

Triste.Dai
 
Posts: 999
Joined: Tue Nov 15, 2022 3:59 am

Wed Jan 18, 2023 3:04 am

Hi,

Greetings from E-iceblue.
The new version which fixes the issue threw by files “financial_statements_sample.xlsx” and “sales-forecast.xlsx” was released, my colleague Abel had informed you the new version (Spire.Office for Java_7.12.4) on 12/30/2022 (xlsx-to-pdf-age-calculation-and-date-format-issue-t11763.html)
Abel.He wrote:Hello,

Thanks for your patience!
Glad to inform you that we just released Spire.Office for Java 7.12.4 which fixes the issue with SPIREXLS-4348、SPIREXLS-4335、SPIREXLS-4331.
Please download the new version from the following links to test.
Website download link: https://www.e-iceblue.com/Download/office-for-java.html

Sincerely
Abel
E-iceblue support team

I’m sorry that I did not inform you the new update in time when the new version was released. Have you already tested the Spire.Office for Java_7.12.4? Does it work for your issue? We are looking forward to your feedback.
Have a nice day!

Sincerely,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 999
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.XLS