Back to Devexpress

Table Properties Dialog

windowsforms-9583-controls-and-libraries-rich-text-editor-visual-elements-dialogs-table-properties-dialogs.md

latest7.9 KB
Original Source

Table Properties Dialog

  • Feb 17, 2021
  • 3 minutes to read

Overview

The Table Properties dialog allows users to change settings of an entire table and its elements: rows, columns, and cells.

Click Properties or Cell Size dialog box launcher on the Table Tools | Layout ribbon tab to invoke this dialog. Refer to the How to: Create a RichEditControl with a Ribbon UI topic for information on how to add the ribbon UI to the RichEditControl.

The Table Properties dialog is also available from the context menu.

The dialog consists of the following tabs:

Table

Table tab options allow users to set preferred table width, alignment (table position relative to page margins), text wrapping and direction.

The following API allows you to specify Table options in code:

MemberDescription
Table.SetPreferredWidthSpecifies the table width.
Table.TableAlignmentSpecifies the table alignment. This property is ignored if the TextWrappingType is set to Around.
Table.TextWrappingTypeSpecifies the text wrapping around the table.

The Options… button invokes the Table Options dialog used to specify cell margins, spacing and whether to resize cells to fit content.

MemberDescription
TableCell.TopPaddingSpecifies the cell’s top margin.
TableCell.RightPaddingSpecifies the cell’s right margin.
TableCell.BottomPaddingSpecifies the cell’s bottom margin.
TableCell.LeftPaddingSpecifies the cell’s left margin.
Table.TableCellSpacingSpecifies the spacing between cells.

The Borders and Shading… button invokes the Borders and Shading dialog. Set the Text Wrapping option to Around to enable the Positioning button (used to invoke the Table Positioning dialog).

Row

The Row tab allows users to set the row height.

Use the following properties to specify row settings in code:

APIDescription
TableRow.HeightTypeGets or sets the rule type that determines the row height.
TableRow.Heightspecifies the row height.
TableRow.RepeatAsHeaderRowDefines whether to repeat a row as header at the top of each page.
TableRow.BreakAcrossPagesSpecifies whether the row can be split when the table expands to another page.

Column

On the Column tab, users can set tick the Preferred width box to specify column width.

Use the following API to set column width in code:

APIDescription
Table.ForEachCell()Allows you to specify width for each table cell.
TableCell.PreferredWidthTypeGets or sets the width type.
TableCell.PreferredWidthDefines cell width.

Cell

Cell tab options allow users to set the preferred table cell width and select the vertical alignment of cell content

The API from the table below allows you to specify the Cell options in code:

MemberDescription
TableCell.PreferredWidthTypeGets or sets the width type.
TableCell.PreferredWidthDefines the cell width.
TableCell.VerticalAlignmentSpecifies cell content’s alignment.

The Options… button invokes the Cell Options dialog. Use this dialog to to change cell margins (the space between cell borders and cell content) and specify whether to wrap the cell content.

MemberDescription
TableCell.TopPaddingSpecifies the cell’s top margin.
TableCell.RightPaddingSpecifies the cell’s right margin.
TableCell.BottomPaddingSpecifies the cell’s bottom margin.
TableCell.LeftPaddingSpecifies the cell’s left margin.
TableCell.WordWrapGets os sets whether to wrap cell content.

Invoke the Dialog in Code

The ShowTablePropertiesFormCommand command invokes the Table Properties dialog.

Handle the RichEditControl.TablePropertiesFormShowing and RichEditControl.TableOptionsFormShowing event to customize the default Table Properties and Table Options dialogs (modify captions, set default dialog values, implement custom validation, etc.) or substitute them with completely new dialogs. Refer to the How to: Customize the Search Form or How to: Customize the Hyperlink Form document for a code sample.

See Also

Tables in Rich Text Documents