Approved
Last Updated: 21 Dec 2017 12:11 by ADMIN
ADMIN
Tanya
Created on: 20 Dec 2017 11:03
Category: RichTextBox
Type: Feature Request
0
RichTextBox: Allow changing the alignment of a Table using the buttons for Paragraph alignment from the UI
In MS Word, the users can change the alignment of a table using the buttons related to Paragraph alignment. To do that, the whole table must be selected.

In RadRichTextBox, selecting a Table and pressing one of the buttons, let say for Right alignment, leads to aligning the content of the table and not the table itself.

Workaround:
private void RadRichTextBox_CommandExecuting(object sender, CommandExecutingEventArgs e)
{
    if (e.Command is ChangeTextAlignmentCommand &&
        this.radRichTextBox.Document.Selection.Ranges.Count == 1 &&
        this.radRichTextBox.Document.Selection.Ranges.First.RangeType == SelectionRangeType.Table &&
        e.CommandParameter.ToString() != "Justify")
    {
        e.Cancel = true;

        RadDocumentEditor editor = new RadDocumentEditor(this.radRichTextBox.Document);
        RadHorizontalAlignment newAlignment = (RadHorizontalAlignment) Enum.Parse(typeof(RadHorizontalAlignment), e.CommandParameter.ToString());
        editor.ChangeTableHorizontalAlignment(newAlignment);
    }
}

NOTE: With this approach, the toggle buttons in the UI are not updated properly and this should be additionally handled.
0 comments