Aspose Cells Stretching images

Hello,
I’m using aspose-cells 17.9 (java) and I’m experiencing images stretching when converting to PDF. I’ve put together a project on Bitbucket to demonstrate the issue. The project can be cloned here: https://bitbucket.org/BobReed1331/asposesupportrequests

There is one branch in the project and executing AsposeCellsConverterTest.java will create an output file called Excel_File_CONVERTED.pdf. The problem can be found on the second page of the output file. There is a comment in the test file explaining the issue further.

I look forward to your response.

Thank you!

@mpont,

Thanks for sample code, template file and details.

After an initial test, I am able to observe the issue as you mentioned by using the following sample code with your template file. I found that images are stretched in the output PDF file as you pointed out. The issue can be seen on the second page of the output PDF:
e.g
Sample code:

Workbook book = new Workbook("XLSX.xlsx"); 
 
//This also does not work. 
Worksheet worksheet = book.getWorksheets().get(0); 
PageSetup pageSetup = worksheet.getPageSetup(); 
pageSetup.setFitToPagesTall(0); 
pageSetup.setFitToPagesWide(1); 

PdfSaveOptions saveOptions = new PdfSaveOptions(SaveFormat.PDF); 
saveOptions.setAllColumnsInOnePagePerSheet(true); 

book.save("out1.pdf", saveOptions);

I have logged a ticket with an id “CELLSJAVA-42429” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

@mpont

The issue is caused by, the row height is automatic but the cached row height is not correct. Please call auto fit row height when opening the file.

Please try the following code:

Java

LoadOptions options = new LoadOptions();

AutoFitterOptions autoFitterOptions = new AutoFitterOptions();
autoFitterOptions.setOnlyAuto(true);
options.setAutoFitterOptions(autoFitterOptions);

Workbook workbook = new Workbook("D:\\Filetemp\\xlsx.xlsx",options); 
Worksheet worksheet = workbook.getWorksheets().get(0);
System.out.print(worksheet.getCells().getRowHeight(3));
PageSetup pageSetup = worksheet.getPageSetup(); 
pageSetup.setFitToPagesTall(0);
pageSetup.setFitToPagesWide(1);

PdfSaveOptions saveOptions = new PdfSaveOptions(SaveFormat.PDF);
saveOptions.setAllColumnsInOnePagePerSheet(true);

workbook.save("D:\\Filetemp\\dest.pdf");