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.

Fri Jul 19, 2024 1:26 pm

Hi!

After the conversion of an Excel file to PDF there is an empty space on the right side of a merged cells region filled in with text.

Are there any conversion settings that can be applied to make an entire region width to be used like in the original Excel file?

We plan to use a commercial version of Spire.XLS for conversion, but testing the library using the trial commercial version 14.6.2 to check if it fully meets our needs first.

Our code:
Code: Select all
val excelFilePath = ...
val pdfFilePath = ...

val workbook: Workbook = new Workbook()

workbook.loadFromFile(excelFilePath)

workbook.getConverterSetting.setSheetFitToWidth(true)
workbook.setCustomFontFileDirectory(Array(<fontsFolder>))

val worksheet: Worksheet = workbook.getWorksheets.get(0)

worksheet.saveToPdf(pdfFilePath)


Attaching original Excel and screenshot of output PDF files.

Thanks, Lesya.
Attachments
2105513_1_1814271914571599872.xlsx.zip
(27.91 KiB) Downloaded 326 times
Screenshot 2024-07-19 at 15.54.48.png
Screenshot 2024-07-19 at 15.54.48.png (286.27 KiB) Viewed 309 times

lklachko
 
Posts: 5
Joined: Fri Jun 28, 2024 12:11 pm

Mon Jul 22, 2024 9:28 am

Hello,

Thanks for your inquriy.
I converted your excel file with the latest commercial Spire.XLS Pack(Hotfix) Version:14.7.2, but I didn't reproduce the issueyou mentioned. To help us investigate further, please provide us with the following information, thanks in advance.
1. Your jdk version,
2. Scala sdk version,
3. Your system information (e.g. Windows 10) and your regional settings (e.g. China, Chinese).

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 454
Joined: Mon Dec 27, 2021 2:23 am

Mon Jul 22, 2024 1:08 pm

Hello,

1. OpenJDK 11.0.22
2. Scala 2.12.8
3. Apple M1 Pro, MacOS Ventura 13.0 (22A380)
4. Region - Ukraine, English

I've also tried to convert the file with latest version released last Friday Spire.XLS for Java v14.7.5, but issue still persists.

Thanks in advance for your help,
Lesya

lklachko
 
Posts: 5
Joined: Fri Jun 28, 2024 12:11 pm

Tue Jul 23, 2024 3:30 am

Hello,

Thanks for more information.
After further testing, we still have not reproduced the issue you mentioned. We speculate that this issue may be related to the font. Could you please provide us the with the output pdf file? In addition, what font files does the "Array(<fontsFolder>)" parameter contain, and whether it contains the Arial font. Looking forward to your reply.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 454
Joined: Mon Dec 27, 2021 2:23 am

Tue Jul 23, 2024 12:43 pm

Hello,

Here are my output pdf file and the content of the fonts folder.
Attachments
fonts_folder.png
fonts_folder.png (62.42 KiB) Viewed 195 times
24SP000004.pdf.zip
(73.08 KiB) Downloaded 333 times

lklachko
 
Posts: 5
Joined: Fri Jun 28, 2024 12:11 pm

Thu Jul 25, 2024 7:40 am

Hello,

Thank you for your patience.
I did further testing with the environment parameters you provided, but failed to reproduce the problem you mentioned. The main difference between us is that you use the ARM architecture Mac OS, while I use the x86 architecture. Do you have other test environments? I packaged my test project into a jar package and uploaded it to here. Can you run it in your environment and give us feedback on the test results? Thanks in advance.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 454
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.XLS