Table cells with Wrapped text do not auto resize in PDF

Greetings,

I am using Aspose Words to create files with tables of content in both .docx and in .pdf. The issue I am having is when I compose the word document, and I have tables that have content that wraps in a cell, regardless of whether it is a header or not, the PDF version does not auto fit to an appropriate cell width for the “column”.

I can save the word document as PDF and it looks fine, but that is not a tenable solution as there is automation involved and depending upon use, we want to generate a word document or a PDF.

I have used methods like Document.UpdateTableLayout() and Table.AutoFit(AutoFitBehavior.*) and there has not been a discernible difference in the PDF table output.

Attached is an example outlining the difference in the table outputs.

PDFWrappingAndLeftOverSpace.zip (34.6 KB)

Thank you for your help!

@sween,

Thanks for your inquiry. Please ZIP and upload your input Word document and Aspose.Words generated output PDF file showing the undesired behavior here for testing. We will investigate the issue on our end and provide you more information.

Both are generated from code. Will just the generated Word and PDF documents suffice?

@sween,

Yes, please provide the generated Word (DOCX) and PDF files.

1 Like

Alright, I have attached a zip with three files… In creating a smaller sample to provide you, I discovered something that is causing the “Table not resizing columns” issue. When we generate PDFs, typically, we add a TextStamp and PageNumberStamp (from the Aspose.PDF namespace). In the zip, you’ll see Sample.docx and SampleWithStamps.pdf which addresses my initial issue. We’re creating a Document with the Stamps and then using the PdfFileEditor.Concatenate() method to concatenate these stamps with the actual content.

I have also enclosed a Sample.pdf which has some wrapping issues without the text and page number stamps.

Samples.zip (207.8 KB)

Thanks!

@sween,

While using the latest version of Aspose.Words i.e. 18.6, we managed to reproduce this incorrect text wrapping/cell width calculation issue on our end. We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-16967. Your thread has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

We used the following code on our end for testing:

Document doc = new Document("D:\\temp\\Samples\\Sample.docx");
// doc.UpdateTableLayout();
doc.Save("D:\\Temp\\Samples\\18.6.pdf");

PDF output produced on our end: 18.6.pdf (72.2 KB)

1 Like

A post was split to a new topic: Table alignment in Aspose.Words generated PDF

The issues you have found earlier (filed as WORDSNET-16967) have been fixed in this Aspose.Words for .NET 23.10 update also available on NuGet.