Back to Devexpress

TableCell.PreferredWidthType Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-tablecell-dd440b9d.md

latest6.2 KB
Original Source

TableCell.PreferredWidthType Property

Gets or sets how the width of a cell is determined if Preferred Width is specified.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
WidthType PreferredWidthType { get; set; }
vb
Property PreferredWidthType As WidthType

Property Value

TypeDescription
WidthType

A WidthType enumeration value specifying how the TableCell.PreferredWidth is interpreted.

|

Available values:

NameDescription
None

Not set.

| | Auto |

Automatically determined width.

| | FiftiethsOfPercent |

Width in fiftieths of a percent.

| | Fixed |

Width in units of measurements that are currently in effect for the document.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the PreferredWidthType property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-richedit-tables-simple-example/CS/TablesSimpleExample/Form1.cs#L32

csharp
table.Rows[0].FirstCell.PreferredWidthType = WidthType.Auto;

word-document-api-table-examples/CS/Program.cs#L53

csharp
//Set the width of the first column
table.Rows[0].FirstCell.PreferredWidthType = WidthType.Fixed;
table.Rows[0].FirstCell.PreferredWidth = Units.InchesToDocumentsF(0.8f);

winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Table.cs#L62

csharp
table[1, 2].PreferredWidthType = WidthType.Fixed;
table[1, 2].PreferredWidth = DevExpress.Office.Utils.Units.InchesToDocumentsF(1.5f);

wpf-richedit-document-api/CS/DXRichEditControlAPISample/CodeExamples/TableActions.cs#L66

csharp
table[1, 1].PreferredWidthType = WidthType.Fixed;
table[1, 1].PreferredWidth = DevExpress.Office.Utils.Units.InchesToDocumentsF(1.5f);

word-document-api-examples/CS/CodeExamples/TablesActions.cs#L97

csharp
// Set the cell width to a fixed value.
table[1, 1].PreferredWidthType = WidthType.Fixed;
table[1, 1].PreferredWidth = DevExpress.Office.Utils.Units.InchesToDocumentsF(1.5f);

winforms-richedit-tables-simple-example/VB/TablesSimpleExample/Form1.vb#L30

vb
table.Rows(0).Cells.InsertBefore(0)
table.Rows(0).FirstCell.PreferredWidthType = WidthType.Auto
table.Rows(0).Cells(1).PreferredWidthType = WidthType.Fixed

word-document-api-table-examples/VB/Program.vb#L42

vb
'Set the width of the first column
table.Rows(0).FirstCell.PreferredWidthType = WidthType.Fixed
table.Rows(0).FirstCell.PreferredWidth = Units.InchesToDocumentsF(0.8F)

winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Table.vb#L53

vb
table.Rows(CInt((1))).Height = DevExpress.Office.Utils.Units.InchesToDocumentsF(0.8F)
table(CInt((1)), CInt((2))).PreferredWidthType = DevExpress.XtraRichEdit.API.Native.WidthType.Fixed
table(CInt((1)), CInt((2))).PreferredWidth = DevExpress.Office.Utils.Units.InchesToDocumentsF(1.5F)

wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/TableActions.vb#L57

vb
table(1, 1).PreferredWidthType = WidthType.Fixed
table(1, 1).PreferredWidth = DevExpress.Office.Utils.Units.InchesToDocumentsF(1.5F)

word-document-api-examples/VB/CodeExamples/TablesActions.vb#L89

vb
' Set the cell width to a fixed value.
table(CInt((1)), CInt((1))).PreferredWidthType = DevExpress.XtraRichEdit.API.Native.WidthType.Fixed
table(CInt((1)), CInt((1))).PreferredWidth = DevExpress.Office.Utils.Units.InchesToDocumentsF(1.5F)

See Also

TableCell Interface

TableCell Members

DevExpress.XtraRichEdit.API.Native Namespace