Free Support Forum - aspose.com

Problem with distance between header and second row in Excel to PDF conversion

Hello,

when converting the attached Excel file to PDF the distance between header and second row is too big, the second row is in the middle of the first page (see attached pdf file).

Can you please tell me when this issue can be resolved?

Thanks in advance.

Best regards,

Sacha End.

								</div>
								</div>

Hi,


I have checked your template Excel file. If you could take the print preview of the sheet in MS Excel, you may also see that the first row is in the middle of the page. Aspose.Cells works the same way as MS Excel does, so your output PDF file has also the similar rendering. Please specify your needs (via PageSetup options etc.) for your input Excel file in MS Excel accordingly then take the PDF file by using Aspose.Cells.

See the attached screen shot for reference.

Hi,

thank you for your quick reply! Here I have another pair of files (Excel / PDF). In this case the converted pdf file is different from the excel print preview (see page 3): In Excel, the first row is on top of the page, in the pdf file it is in the middle.

Best regards,
Sacha End.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We were able to replicate this issue using the latest version: Aspose.Cells
for .NET v7.3.4.2
.

We have logged this issue in our database. We will look into this issue and fix it. Once the issue is fixed or we have some other update for you, we will share it with you asap.

This issue has been logged as CELLSNET-41241.

Below is a sample code used to test this issue. I have also attached the source file, printer output pdf and the Aspose.Cells output pdf for your reference

C#


string filePath = @“F:\Shak-Data-RW\Downloads\10722a.xls”;


Workbook workbook = new Workbook(filePath);

workbook.Save(filePath + “.out.pdf”, SaveFormat.Pdf);

dhcvision:
Hi,

thank you for your quick reply! Here I have another pair of files (Excel / PDF). In this case the converted pdf file is different from the excel print preview (see page 3): In Excel, the first row is on top of the page, in the pdf file it is in the middle.

Best regards,
Sacha End.
Hi,

Thanks for your posting and using Aspose.Cells.

We have looked into your issue and found that Microsoft Excel will autofit when it open the workbook i.e "10722a.xls".

We do not do same thing automatically, but you can use workbook.Worksheets[0].AutoFitRows(true); to autofitrows then the output result is the same as excel.

Please see the complete code below. I have attached the output pdf file and screenshot for your reference.

C#
string filePath = @"F:\Shak-Data-RW\Downloads\10722a.xls";

Workbook workbook = new Workbook(filePath);
workbook.Worksheets[0].AutoFitRows(true);

PdfSaveOptions opts = new PdfSaveOptions(SaveFormat.Pdf);
opts.OnePagePerSheet = true;

workbook.Save(filePath + ".out.pdf", opts);

Screenshot:

The issues you have found earlier (filed as CELLSNET-41241) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.