ChangeTableCellFormattingCommand.execute(settings) Method
Executes the ChangeTableCellFormattingCommand command by applying the specified setting.
May result in taking no action if the command’s state does not allow command execution. Use the object’s getState method to check the command state.
Declaration
execute(
settings: TableCellFormattingSettings
): boolean
Parameters
Name | Type | Description |
---|---|---|
settings | TableCellFormattingSettings | A TableFormattingSettings object specifying cell formatting of the selected table elements. |
Returns
Type | Description |
---|---|
boolean | A Boolean value identifying whether method execution was successful or failed. |
Remarks
The execute method checks the command state (obtained using the getState method) before executing, and decides whether the action can be performed.
The command includes size parameters assigned in twips. Use the ASPxClientRichEdit.unitConverter to convert size measure units (inches, points, pixels, centimeters) to twips.
Usage example
var cellFormatSettings = {marginsSameAsTable: false, marginBottom: richEdit.unitConverter.pixelsToTwips(50)};
richEdit.commands.changeTableCellFormatting.execute(cellFormatSettings);
The vertical margin settings (top and bottom) for each table cell in a row is calculated by getting the maximum vertical margin values from all cells in the row.
The preferredWidth parameter allows you to specify a width value of selected table cells. The parameter is applied when the preferredWidth value of the whole table is cleared. The following code snippet demonstrates how to disable the width settings of the whole table and define the preferredWidth value for the selected table cells.
var tableSettings = {preferredWidth: {type: ASPx.TableWidthUnitType.Nil, value: 0}, resizeToFitContent: false};
richEdit.commands.changeTableFormatting.execute(tableSettings);
var tableCellSettings = {preferredWidth: {type: ASPx.TableWidthUnitType.ModelUnits, value: richEdit.unitConverter.pixelsToTwips(75)}};
richEdit.commands.changeTableCellFormatting.execute(tableCellSettings);