Edit this page

Strip Formatting Tools

This article provides information about the built-in Format Stripper dropdown, and the Strip Formatting tools exposed inside.

The Strip Formatting tools enable the end-user to strip the formatting from existing content.The built-in Format Stripper dropdown exposes a list of Strip Formatting tools for the user to choose from (Figure 1). The following list specifies each tool’s purpose:

  • Strip All Formatting—removes all styles and formatting applied to the content (i.e., transforms it to plain text).

  • Strip Css Formatting—removes all inline CSS rules (i.e., the style attribute).

  • Strip Font Elements—strips all <font> tags from the HTML content.

  • Strip Span Elements—strips all <span> tags from the HTML content.

  • Strip Word Formatting—cleans the HTML content from unnecessary XML tags and comments inserted by pasting MS Word content.

Figure 1: Plain HTML content, later (in Figure 2) stripped to plain text.

editor-paste-dialogs-result

Figure 2: Transforming HTML content to plain text via Strip All Formatting tool.

editor-format-stripper

Adding Format Stripper Tool to a Custom Tool-set

In a custom collection of tools, the build-in Format Stripper dropdowncan be added by adding a plain tool with a name set to FormatStripper (Example 1).

Example 1: Adding the PasteStrip dropdown to a tools collection.

//Defining FormatStripper with Tools collection:
<telerik:RadEditor RenderMode="Lightweight" runat="server" ID="RadEditor1">
    <Tools>
        <telerik:EditorToolGroup>
            <telerik:EditorTool Name="FormatStripper" />
        </telerik:EditorToolGroup>
    </Tools>
</telerik:RadEditor>
//Defining FormatStripper with ToolsFile property:
<telerik:RadEditor RenderMode="Lightweight" runat="server" ID="RadEditor2" ToolsFile="Tools.xml">
</telerik:RadEditor>
<!--Tools.xml-->
<root>
  <tools>
    <tool name="FormatStripper" />
  </tools>
</root>

Optionally, you can further enable stand-alone Strip Formatting tools in a toolbar or fine tune the collection inside the PasteStrip dropdown (Example 2).

Figure 2: The result of the tools collection configuration in Example 2.

custom-strip-tools-collection

Example 2: Defining stand-alone Strip Formatting tools in a toolbar and a custom set of tools in the PasteStrip dropdown.

//Defining FormatStripper with Tools collection:
<telerik:RadEditor RenderMode="Lightweight" runat="server" ID="RadEditor1" Skin="Silk" Width="500px" Height="250px">
    <Tools>
        <telerik:EditorToolGroup>
            <telerik:EditorToolStrip Name="FormatStripper">
                <telerik:EditorTool Name="StripAll" />
                <telerik:EditorTool Name="StripCss" />
                <telerik:EditorTool Name="StripWord" />
            </telerik:EditorToolStrip>
        </telerik:EditorToolGroup>
        <telerik:EditorToolGroup>
            <telerik:EditorTool Name="StripSpan" />
            <telerik:EditorTool Name="StripFont" />
        </telerik:EditorToolGroup>
    </Tools>
</telerik:RadEditor>
//Defining FormatStripper with ToolsFile property:
<telerik:RadEditor RenderMode="Lightweight" runat="server" ID="RadEditor2" Skin="Silk" Width="500px" Height="250px" ToolsFile="Tools.xml">
</telerik:RadEditor>    
<!--Tools.xml-->
<root>
  <tools>
    <tool name="FormatStripper" >
      <tool name="StripAll"/>
      <tool name="StripCss"/>
      <tool name="StripWord"/>
    </tool>
  </tools>
  <tools>
      <tool name="StripSpan"/>
      <tool name="StripFont"/>
  </tools>
</root> 

See Also