How to control "automatically resize to fit contents"?

How to control the highlighted property when we insert an html table into a word document using inserthtml function. By default this is getting checked, I want to check and un check this based on some condition.

@shinojtb You can use CellFormat.FitText property to set this option.

@alexey.noskov Thank you for the reponse :slight_smile: , but i am using an html code to insert the table, something like this builder.InsertHtml({html table code})

@shinojtb I am afraid HTML does not have an attribute that corresponds this option in MS Word table.

@alexey.noskov I am doing something like this, is there a way to control through this? BTW, this code is not working.

NodeCollection tables = doc.GetChildNodes(NodeType.Table, true);
foreach (Table t in tables)
{
    t.AutoFit(AutoFitBehavior.AutoFitToWindow);                    
}

@shinojtb This method mimics the commands available in the Auto Fit menu for a table in Microsoft Word. The commands available are “Auto Fit to Contents”, “Auto Fit to Window” and “Fixed Column Width”. In Microsoft Word these commands set relevant table properties and then update the table layout and Aspose.Words does the same.