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

Free Support Forum - aspose.com

Text Wrap in Table cell

Hi,


I have a table with long text in the cell which does not allow to fit the table in the Word document.

Is there any way through Aspose APIs to apply wrap text for the table cell text ?

Regards,
Prabhaker Kr

Hi Prabhaker,


Thanks for your inquiry. Could you please attach your input Word document and expected document here for our reference. We will investigate the structure of your expected document as to how you want your final output be generated like. You can create expected document using Microsoft Word. We will then provide you code to achieve the same using Aspose.Words.

Best regards,

Hi Awais,


I have attached the document with the issue description, code used and the expected output.

Please take a look and suggest some solution for it.


Regards,
Prabhaker Kr

Hi Prabhaker,


Thanks for your inquiry. At the end after when you have inserted the Table from HTML, please try using the following code:
Document doc = new Document(getMyDir() + “Gen.docx”);
Table tab = (Table)doc.getChildNodes(NodeType.TABLE, true).get(0);
tab.setAllowAutoFit(false);
tab.setPreferredWidth(PreferredWidth.fromPercent(100));
doc.save(getMyDir() + “15.8.0.docx”);
I hope, this helps.

Bets regards,

Hi Awais,


Thank you for the help. The issue is fixed now. I am able to fix the table width now as per the requirement.

Thanks & Regards,
Prabhaker Kr