officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-tablecell-65c81eab.md
Gets or sets the numerical value of the preferred width.
Namespace : DevExpress.XtraRichEdit.API.Native
Assembly : DevExpress.RichEdit.v25.2.Core.dll
NuGet Package : DevExpress.RichEdit.Core
float PreferredWidth { get; set; }
Property PreferredWidth As Single
| Type | Description |
|---|---|
| Single |
A Single value specifying the cell width.
|
How the PreferredWidth value is interpreted depends on other parameters, such as the TableCell.PreferredWidthType and the Document.Unit properties.
Note
If using the PreferredWidth property, specify the TableCell.PreferredWidthType beforehand.
We do not recommend setting different size to several cells within one column. It changes the layout of the whole column.
The following code snippets (auto-collected from DevExpress Examples) contain references to the PreferredWidth 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#L35
table.Rows[0].Cells[1].PreferredWidthType = WidthType.Fixed;
table.Rows[0].Cells[1].PreferredWidth = Units.InchesToDocumentsF(0.8f);
word-document-api-table-examples/CS/Program.cs#L54
table.Rows[0].FirstCell.PreferredWidthType = WidthType.Fixed;
table.Rows[0].FirstCell.PreferredWidth = Units.InchesToDocumentsF(0.8f);
case 0:
cell.PreferredWidth = 200;
break;
winforms-richedit-document-api/CS/RichEditAPISample/CodeExamples/Table.cs#L63
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#L67
table[1, 1].PreferredWidthType = WidthType.Fixed;
table[1, 1].PreferredWidth = DevExpress.Office.Utils.Units.InchesToDocumentsF(1.5f);
#endregion #CreateFixedTable
winforms-richedit-tables-simple-example/VB/TablesSimpleExample/Form1.vb#L32
table.Rows(0).Cells(1).PreferredWidthType = WidthType.Fixed
table.Rows(0).Cells(1).PreferredWidth = Units.InchesToDocumentsF(0.8F)
' Set the second column width and cell height
word-document-api-table-examples/VB/Program.vb#L43
table.Rows(0).FirstCell.PreferredWidthType = WidthType.Fixed
table.Rows(0).FirstCell.PreferredWidth = Units.InchesToDocumentsF(0.8F)
'Set the second column width and cell height
Case 0
cell.PreferredWidth = 200
Case 1
winforms-richedit-document-api/VB/RichEditAPISample/CodeExamples/Table.vb#L54
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)
#End Region ' #CreateFixedTable
wpf-richedit-document-api/VB/DXRichEditControlAPISample/CodeExamples/TableActions.vb#L58
table(1, 1).PreferredWidthType = WidthType.Fixed
table(1, 1).PreferredWidth = DevExpress.Office.Utils.Units.InchesToDocumentsF(1.5F)
' #End Region ' #CreateFixedTable
See Also