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);
doc.Save(@"Test.docx");
doc.Save(@"Test.pdf");
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.
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:
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.