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

Free Support Forum - aspose.com

Autoresize of cells in table

Hi - I am writing a generic routine that would populate a datatable in word. How do I autoresize the columns based on the contents? Please provide example code in c#
Thanks

Hi
Thanks for your inquiry. I think that you can try using FitText and WrapText properties. For example see the following code.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.CellFormat.FitText = false;
builder.CellFormat.WrapText = false;
builder.InsertCell();
builder.Write("Aspose.Words test text ");
builder.EndRow();
builder.EndTable();
doc.Save(@"Test022\out.doc");

I hope this could help you.
If you are using a template then you can attach it here for testing.
Best regards.

Sorry your suggestion does not work

Hi
Could you please attach your documents for investigating? I will try to find solution for you.
Best regards.