private static void RetrievePreferredWidthType(string dataDir)
{
// ExStart:RetrievePreferredWidthType
Document doc = new Document(dataDir + "Table.SimpleTable.doc");
// Retrieve the first table in the document.
Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
// ExStart:AllowAutoFit
table.AllowAutoFit = true;
// ExEnd:AllowAutoFit
Cell firstCell = table.FirstRow.FirstCell;
PreferredWidthType type = firstCell.CellFormat.PreferredWidth.Type;
double value = firstCell.CellFormat.PreferredWidth.Value;
// ExEnd:RetrievePreferredWidthType
Console.WriteLine("\nTable preferred width type value is " + value.ToString());
}
}