officefileapi-117410-word-processing-document-api-examples-tables-how-to-create-a-table-with-fixed-column-width.md
To create a table with fixed column widths, specify the following settings:
| Property | Value |
|---|---|
| For the table set the Table.TableLayout | TableLayoutType.Fixed |
| For the table set the Table.PreferredWidthType | WidthType.Fixed |
| For each cell set the TableCell.PreferredWidthType | WidthType.Fixed |
| For each cell set the TableCell.PreferredWidth | A floating point value specifying the cell width measured in document units of measurement determined by the Document.Unit property. |
using XtraRichEdit.API.Native;
using DevExpress.Office.Utils;
using (var wordProcessor = new richEditDocumentServer())
{
Document document = wordProcessor.Document;
Table table = document.Tables.Create(document.Range.Start, 3, 3);
table.TableAlignment = TableRowAlignment.Center;
table.TableLayout = TableLayoutType.Fixed;
table.PreferredWidthType = WidthType.Fixed;
table.PreferredWidth = .Units.InchesToDocumentsF(4f);
table.Rows[1].HeightType = HeightType.Exact;
table.Rows[1].Height = Units.InchesToDocumentsF(0.8f);
table[1, 1].PreferredWidthType = WidthType.Fixed;
table[1, 1].PreferredWidth = Units.InchesToDocumentsF(1.5f);
table.MergeCells(table[1, 1], table[2, 1]);
}
Imports XtraRichEdit.API.Native
Imports DevExpress.Office.Utils
Using wordProcessor = New richEditDocumentServer()
Dim document As Document = wordProcessor.Document
Dim table As Table = document.Tables.Create(document.Range.Start, 3, 3)
table.TableAlignment = TableRowAlignment.Center
table.TableLayout = TableLayoutType.Fixed
table.PreferredWidthType = WidthType.Fixed
table.PreferredWidth =.Units.InchesToDocumentsF(4F)
table.Rows(1).HeightType = HeightType.Exact
table.Rows(1).Height = Units.InchesToDocumentsF(0.8F)
table(1, 1).PreferredWidthType = WidthType.Fixed
table(1, 1).PreferredWidth = Units.InchesToDocumentsF(1.5F)
table.MergeCells(table(1, 1), table(2, 1))
End Using