We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Save as Pdf and save as excel has different result

Hi,
I am using the latest Version of Aspose.Cells and using .Net .

I exported a file in pdf and excel format by using these code:

workbook.Save("fullPath",SaveFormat.Xlsx);//for test only

workbook.Save("fullPath", SaveFormat.Pdf);//for expected output

however, the two result is different. the row A13 in the file with pdf format has a higher height (About 2 row) and The row A13 in the file with excel format has 1 row height.

The result of excel is the result i want, but i need to export as pdf.

example.zip (38.3 KB)

@NickMina,
Thank you for your query.
You have shared the output files however the source template file is not shared which is saved as XLSX and PDF. Please share the source template file for our testing.

@NickMina,
We were able to observe the issue by using your output XLSX file again, but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-47378 – Row height increased in PDF

Thank you very much :smiley:

@NickMina,
You are welcome.

@NickMina,
Row 13 is auto height, when the source file is opened in Microsoft Excel, Excel will automatically autofit the height of the rows that are auto height.
Using the following code, it will be OK:

Workbook workbook = new Workbook(srcFile);

foreach(Worksheet sheet in workbook.Worksheets)
{
    sheet.AutoFitRows(true);
}

workbook.Save(output.pdf);

Let us know your feedback.

7 posts were split to a new topic: Save as Pdf rendering issue

Sorry for late reply. The test takes me some time.
It works and this seems to be the best solution for me!
Thank you for your help!

@NickMina,

Good to know that your issue is sorted out by the suggested lines of code. Feel free to write us back if you need further help or have some other issue or queries, we will be happy to assist you soon.