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.

Tue Jun 06, 2023 2:05 pm

Hi Team,
I'm converting excel file into PDF format using spire.office-8.5.6 Java API jar.
In the "Portfolio Valuation Model - Apera Dec2.xlsm" file, I have hidden columns in the some of the tabs. Those column / row values are converted as expected. When I click the + icon, 3 columns are expanded and those values are missing in the converted pdf file.
I have attached screenshots and sample source code for your reference.
I could not attach source file in this thread, so I will share the same thru email.

I really appreciate your support in advance.

Apera-HiddenColumn.zip
(649.07 KiB) Downloaded 419 times

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

Wed Jun 07, 2023 7:21 am

Hello,

Thanks for your inquiry!
Kindly note that our Spire.Office does not convert hidden rows or columns when converting Excel to PDF. Therefore, you need to unhide the rows or columns before conversion. Please refer to following modified code for testing, and if you have any further questions, please feel free to contact us.
Code: Select all
for (int col = worksheet.getFirstColumn(); col <= worksheet.getLastColumn(); col++) {
    boolean columnIsHide = worksheet.getColumnIsHide(col);
    if (columnIsHide) {
        worksheet.showColumn(col);
    }
    CellStyle style = worksheet.getDefaultColumnStyle(col);
    style.setShrinkToFit(true);
    style.setWrapText(false);
}

Best Regards,
Swain
E-iceblue support team
User avatar

Swain.Wang
 
Posts: 34
Joined: Thu Jun 01, 2023 3:55 am

Thu Jun 08, 2023 10:44 am

Hi,
It worked !
Thanks for your support.

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

Fri Jun 09, 2023 1:23 am

Hello,

Thanks for your feedback!
Glad to hear that! If you encounter any issue related to our products in the future, just feel free to contact us.
Wish you all the best!

Sincerely,
Swain
E-iceblue support team
User avatar

Swain.Wang
 
Posts: 34
Joined: Thu Jun 01, 2023 3:55 am

Return to Spire.XLS