Excel2PDF: (1) cell height with autoFitRows(); (2) graphic fragments in printheader (repeated rows at top)

Hello,

I found two problems when saving an Excel report to PDF:

(1) autoFitRows()
When using autoFitRows() to correctly display cells whose text content won’t fit in a single line, the cell’s height is calculated incorrectly, making it look like there was an additional blank line below the multiline cell. (See line 25 in the attached pdf example).

(2) printheader (repeated rows at top)
In some of our reports, we use “repeated rows at top” to repeat the headline and table header on subsequent pages. This works fine, but in some (not all) cases, there are fragments of the last data line of page 1 visible inside the repeated table header on page 2 (see printheader-problem.gif in the attached zipfile).
As a likely part of the problem, I found that the last data row of a previous page seems to be somehow “contained” in the header of a subsequent page, even if there it is “most of the time” (and preferably) hidden. In Acrobat Reader, however, when I make a selection on the table header of page 1 in the attached generated PDF-file, and copy/paste it into notepad, I get “Col1 Col2 Col3” which is correct. Doing the same with the table header on page 2, I get “VCaollu1e A54 VCaollu2e B54 VCaollu3e C54” which is a mixture of the table header and the last data row of page 1. This is probably causing the occasional graphic fragments as shown in printheader-problem.gif).


I have attached the ready-to-run sources for both problems (even though the graphic fragments are not visible in my code example, unfortunately).

Thanks in advance for your help!
Lennart

Hi,

Thanks for providing us the project.

1) I can find the first issue you mentioned regarding auto-fit operation for pdf file. We will look into it and fix it soon. I have logged your issue into our issue tracking system with an issue id: CELLSJAVA-17964.

2) I could not find your second issue, please create a simple project to show this issue, we will check it soon.

Thank you.

Hi,

thank you for your reply.

Concerning issue #2: The problem can be reproduced with text in the last data row that contains letters like “g” or “y”, i.e. such letters that go “below” the text baseline. I have attached the modified class for my latter Java example that produces a PDF with the described faulty table header on page 2.

Are you able to reproduce that bug?

Best regards
Lennart

Hi,

Now, I can find the issue using your changed code, we will look into it soon.

Thank you.

Hi Lennart,

Please try the Aspose.Cells for Java version attached in this thread owned by you.

We have fixed the autoFitRows and print title issues in Excel to PDF export.

Thank you

Hi Muhammad,

the new jar fixed the issues. Good work!

Thank you very much
Lennart