Free Support Forum - aspose.com

Converting Excel 2007 to PDF: Multi-line cells (containing newlines- not wrapping) get collapsed

We are using Aspose.Cells v7.3.5.0 and Aspose.Pdf v7.6.0.0, and we have an Excel 2007 document (see attached) that has multi-line text in some cells. Note this is text that contains line breaks, not wrapped text. In the attached document, see the first sheet (Screening Day - 28) cell H32 for an example (there are others, but that is the most obvious one). When we convert this document to PDF, the cells containing multi-line text are truncated to just the first line (the remaining text isn’t just hidden, it’s gone), and the row height is shrunken to fit just the one line. We’ve attempted calling AutoFitRows, but that doesn’t seem to have any effect.

Hi,

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

We have found this issue. We have attached the screenshot for your reference. We have logged this issue in our database. We will look into this issue and resolve it. Once the issue is resolved or we have some other update for you, we will share it with you asap.

This issue has been logged as CELLSNET-41536.

I've attached screenshots of the specific problem I was referencing in the original post. In the Excel version note the multi-line text in the cell (circled in red), and note that the PDF version has only the first line of text, and the cell is collapsed (also circled in red).

Hi,


Thanks for providing us screen shots which are more helpful.

We also noticed this issue for the first worksheet cells (especially H32 cell) as well.

As you are more concerned to have this issue fixed, so we will consider to fix this issue as well for the first worksheet. I have logged the comments against your existing issue id “CELLSNET-41536”.

Once we figure out your issue, we will let you know here.

Thanks,

Hi,


We have looked into your issue further. We suggest you to kindly try using the following code before converting to PDF:

Sample code:

//…

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

Actually the row will be auto expanded by MS Excel when one does not specify the height of the rows. But Aspose.Cells will not auto-expand it automatically, so please use AutoFitRows option (via API) before converting to PDF, it will fix your issue.

Thank you.

Hello,

Thank you for taking the time to look at this issue for us. I have implemented the solution you offered, but unfortunately it doesn't appear to have made any difference. The resulting PDF appears exactly as the screenshots above--the worksheet cells that contain newlines (NOTE: not wrapped lines, but actual newline characters) still get truncated and collapsed.

Thanks,

Dave Frogley

Hi,


Could you attach your output PDF files after adding the changes (add AutoFitRows function(s)) before the conversion, we will investigate it further.

Thank you.

Hello again,

My apologies, I realized after some more testing that the test I was running had been modified to do something else, so AutoFitRows wasn't actually getting called as I thought it was. Oops :)

I ran the test again, this time calling AutoFitRows, and it worked for me as you suggested. Thank you. I'll let our clients know and see if it also works for them.

Thanks!

Dave Frogley

Hi,

That is great that your issue is sorted out.

Feel free to contact us any time if have further query or issue, we will be happy to assist you here.

Thank you.