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

Free Support Forum - aspose.com

Text of Table Cell does not Wrap in DOCX | Optimize Document to MS Word Version using .NET


I created document with table. First cell contains CellFormat.WrapText with false value. Both cells have preferred width 50% and table has preferred width 100%. When document is saved to docx both cells doesn’t wrap. When document is saved to pdf both cells is wrap.

See the sample program:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

var table = builder.StartTable();

var cel1 = builder.InsertCell();
cel1.CellFormat.WrapText = false;
builder.Write("Text Text Text Text Text Text Text Text Text Text");
cel1.CellFormat.PreferredWidth = PreferredWidth.FromPercent(50);

var cel2 = builder.InsertCell();
cel2.CellFormat.PreferredWidth = PreferredWidth.FromPercent(50);
builder.Write("Text Text Text Text Text Text Text Text Text Text");

table.PreferredWidth = PreferredWidth.FromPercent(100);


We’re using Aspose.Words for .Net v21.6.0.



Please note that Aspose.Words mimic the behavior of MS Word 2019 when you save the document to PDF. You can get the same output for DOCX using following code snippet.

doc.Save(MyDir + @"Test.docx");
doc.Save(MyDir + @"Test.pdf"); 

Thank you. I have the same output in word like in pdf and cell in table is wrap in both document. I want pdf have the same output like word. In meantime I found ticket:

So I will be waiting for this fix.



We will inform you via your other thread when the fix of WORDSNET-21289 is available.