PreferredWidthType enumeration

Specifies the unit of measurement for the preferred width of a table or cell.

public enum PreferredWidthType


Name Value Description
Auto 1 The preferred width is not specified. The actual width of the table or cell is either specified using the explicit width or will be determined automatically by the table layout algorithm when the table is displayed, depending on the table auto fit setting.
Percent 2 Measure the current item width using a specified percentage.
Points 3 Measure the current item width using a specified number of points (1/72 inch).


Shows how to verify the preferred width type and value of a table cell.

Document doc = new Document(MyDir + "Tables.docx");

Table table = doc.FirstSection.Body.Tables[0];
Cell firstCell = table.FirstRow.FirstCell;

Assert.AreEqual(PreferredWidthType.Percent, firstCell.CellFormat.PreferredWidth.Type);
Assert.AreEqual(11.16d, firstCell.CellFormat.PreferredWidth.Value);

See Also