Table Properties Dialog

  • 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.

RichEdit_ShowTablePropertiesDialog_RibbonPropertiesButton

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

RichEdit_ShowTablePropertiesDialog_ContextMenu

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.

RichEdit_TableProperties_Table

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

Member Description
Table.SetPreferredWidth Specifies the table width.
Table.TableAlignment Specifies the table alignment. This property is ignored if the TextWrappingType is set to Around.
Table.TextWrappingType Specifies 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.

RichEdit_TableOptionsDialog

Member Description
TableCell.TopPadding Specifies the cell's top margin.
TableCell.RightPadding Specifies the cell's right margin.
TableCell.BottomPadding Specifies the cell's bottom margin.
TableCell.LeftPadding Specifies the cell's left margin.
Table.TableCellSpacing Specifies 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.

RichEdit_TableProperties_Row

Use the TableRow.HeightType and TableRow.Height properties to specify row height in code.

Column

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

RichEdit_TableProperties_Column

Use the following API to set column width in code:

Column A Column B
Table.ForEachCell() Allows you to specify width for each table cell.
TableCell.PreferredWidthType Gets or sets the width type.
TableCell.PreferredWidth Defines cell width.

Cell

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

RichEdit_TableProperties_Cell

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

Member Description
TableCell.PreferredWidthType Gets or sets the width type.
TableCell.PreferredWidth Defines the cell width.
TableCell.VerticalAlignment Specifies 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.

RichEdit_CellOptionsDialog

Member Description
TableCell.TopPadding Specifies the cell's top margin.
TableCell.RightPadding Specifies the cell's right margin.
TableCell.BottomPadding Specifies the cell's bottom margin.
TableCell.LeftPadding Specifies the cell's left margin.
Table.TableCellSpacing Specifies the spacing between cells.
TableCell.WordWrap gets 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