Skip to main content

ToolbarParagraphFormattingEdit Class

A default toolbar editor that allows a predefined paragraph style to be applied to the selected paragraph within the design view area.

Namespace: DevExpress.Web.ASPxHtmlEditor

Assembly: DevExpress.Web.ASPxHtmlEditor.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public class ToolbarParagraphFormattingEdit :
    ToolbarComboBoxBase

Remarks

The ASPxHtmlEditor allows end-users to set a paragraph formatting for the editor’s selected text by using the Paragraph button. Clicking this button opens a drop down window with predefined paragraph styles.

ASPxHtmlEditor-Concepts-WorkWithContent-ParagraphDropDown

You can add the Paragraph button to toolbars by using either the ASPxHtmlEditor designer at design time, or programmatically.

protected void Page_Load(object sender, EventArgs e) {
    HtmlEditorToolbar stToolbar1 = HtmlEditorToolbar.CreateStandardToolbar1();
    ToolbarParagraphFormattingEdit paragButton = new ToolbarParagraphFormattingEdit();
    ToolbarListEditItem item1 = new ToolbarListEditItem();
    item1.Text = "Normal";
    item1.Value = "p";
    ToolbarListEditItem item2 = new ToolbarListEditItem();
    item2.Text = "Heading  1";
    item2.Value = "h1";
    ToolbarListEditItem item3 = new ToolbarListEditItem();
    item3.Text = "Heading  2";
    item3.Value = "h2";
    ToolbarListEditItem item4 = new ToolbarListEditItem();
    item4.Text = "Heading  3";
    item4.Value = "h3";
    ToolbarListEditItem item5 = new ToolbarListEditItem();
    item5.Text = "Heading  4";
    item5.Value = "h4";
    ToolbarListEditItem item6 = new ToolbarListEditItem();
    item6.Text = "Heading  5";
    item6.Value = "h5";
    ToolbarListEditItem item7 = new ToolbarListEditItem();
    item7.Text = "Heading  6";
    item7.Value = "h6";
    ToolbarListEditItem item8 = new ToolbarListEditItem();
    item8.Text = "Address";
    item8.Value = "address";
    ToolbarListEditItem item9 = new ToolbarListEditItem();
    item9.Text = "Normal (DIV)";
    item9.Value = "div";
    paragButton.Items.Add(item1);
    paragButton.Items.Add(item2);
    paragButton.Items.Add(item3);
    paragButton.Items.Add(item4);
    paragButton.Items.Add(item5);
    paragButton.Items.Add(item6);
    paragButton.Items.Add(item7);
    paragButton.Items.Add(item8);
    paragButton.Items.Add(item9);
    stToolbar1.Items.Add(paragButton);
    ASPxHtmlEditor1.Toolbars.Add(stToolbar1);
}
See Also