CuteEditor for .NET

Paragraph Dropdown Customization

The Paragraph Dropdown of CuteEditor by default displays a predefined set of format blocks. You can easily modify this default set using the following methods:

1. Edit Dropdown Configuration File (Common.config).

The dropdown configuration file (Common.config) can be found in the /CuteEditor/Configuration/Shared folder. In dropdown configuration file you can find the FormatBlock element which contains the configuration information for the Paragraph dropdown within CuteEditor. By default, it contains the following format blocks:


You can modify the FormatBlock element to create your own format block list.

Example:

  1. <FormatBlock>  
  2.     <item text="[[DIV]]" value="&lt;DIV&gt;">  
  3.         <html><![CDATA[[[DIV]]]]></html>  
  4.     </item>  
  5.     <item text="[[Normal]]" value="&lt;P&gt;">  
  6.         <html><![CDATA[[[Normal]]]]></html>  
  7.     </item>  
  8.     <item text="[[Heading 1]]" value="&lt;H1&gt;">  
  9.         <html><![CDATA[<b style='font-size:24pt'>[[Heading 1]]</b>]]></html>  
  10.     </item>  
  11.     <item text="[[Heading 2]]" value="&lt;H2&gt;">  
  12.         <html><![CDATA[<b style='font-size:18pt'>[[Heading 2]]</b>]]></html>  
  13.     </item>  
  14.     <item text="[[Heading 3]]" value="&lt;H3&gt;">  
  15.         <html><![CDATA[<b style='font-size:15pt'>[[Heading 3]]</b>]]></html>  
  16.     </item>  
  17.     <item text="[[Heading 4]]" value="&lt;H4&gt;">  
  18.         <html><![CDATA[<b style='font-size:12pt'>[[Heading 4]]</b>]]></html>  
  19.     </item>  
  20.     <item text="[[Heading 5]]" value="&lt;H5&gt;">  
  21.         <html><![CDATA[<b style='font-size:9pt'>[[Heading 5]]</b>]]></html>  
  22.     </item>  
  23.     <item text="[[Heading 6]]" value="&lt;H6&gt;">  
  24.         <html><![CDATA[<b style='font-size:7pt'>[[Heading 6]]</b>]]></html>  
  25.     </item>  
  26.     <item text="[[Address]]" value="&lt;Address&gt;">  
  27.         <html><![CDATA[[[Address]]]]></html>  
  28.     </item>  
  29.     <item text="[[MenuList]]" value="&lt;MENU&gt;">  
  30.         <html><![CDATA[[[MenuList]]]]></html>  
  31.     </item>  
  32.     <item text="[[Formatted]]" value="&lt;PRE&gt;">  
  33.         <html><![CDATA[[[Formatted]]]]></html>  
  34.     </item>  
  35.     <item text="[[Definition Term]]" value="&lt;DT&gt;">  
  36.         <html><![CDATA[[[Definition Term]]]]></html>  
  37.     </item>  
  38. </FormatBlock>  

Now the Paragraph dropdown contains only Heading 1, Heading 5 and Normal.



2. Programmatically populate the Paragraph dropdown:

C# Example:

  1. if (!IsPostBack) {    
  2.    CuteEditor.ToolControl toolctrl=Editor1.ToolControls["FormatBlock"];    
  3.    if(toolctrl!=null) {    
  4.       CuteEditor.RichDropDownList dropdown=(CuteEditor.RichDropDownList)toolctrl.Control;    
  5.       //the first item is the caption    
  6.       CuteEditor.RichListItem richitem=dropdown.Items[0];    
  7.       //clear the items from configuration files    
  8.       dropdown.Items.Clear();    
  9.       //add the caption   
  10.        dropdown.Items.Add(richitem);    
  11.      //add text and value    
  12.        dropdown.Items.Add("Normal","<p>");    
  13.       //add text and value    
  14.       dropdown.Items.Add("Heading      1","<h1>");    
  15.       //add html and text and value    
  16.       dropdown.Items.Add("<b style=      'font-size:9pt'>[[Heading 5]]</b>","Heading5","<h5>");    
  17.    }    
  18. }  

VB Example:

  1. If Not Page.IsPostBack Then  
  2.   If Not Editor1.ToolControls("FormatBlock"Is Nothing Then  
  3.       Dim dropdown As CuteEditor.RichDropDownList   
  4.       Dim richitem As CuteEditor.RichListItem   
  5.       dropdown = DirectCast(Editor1.ToolControls("FormatBlock").Control, CuteEditor.RichDropDownList)   
  6.       'the first item is the caption   
  7.       richitem = dropdown.Items(0)   
  8.       'clear the items from configuration files   
  9.       dropdown.Items.Clear()   
  10.       'add the caption   
  11.       dropdown.Items.Add(richitem)   
  12.       'add text and value   
  13.       dropdown.Items.Add("Normal","<p>")   
  14.       'add value and value   
  15.        dropdown.Items.Add("Heading 1","<h1>")   
  16.       'Add html and text and value   
  17.       dropdown.Items.Add("<b style='font-size:9pt'>[[Heading 5]]</b>""Heading 5""<h5>")   
  18.   End If  
  19. End If