• Material 3
  • Fluent
  • Bootstrap v5
  • Tailwind CSS
  • High Contrast
Theme Selection
Theme Modes
Mode Selection
*Translated by Google Translator.

Example of Paste from MS Word in ASP.NET MVC Rich Text Editor Control

This example demonstrates the paste cleanup feature of the Rich Text Editor control. Copy your content from MS Word or other website, and paste it within the editor to cleanup.

Format Option
Denied Tags
Denied Attributes
Allowed Style Properties

The Rich Text Editor allows to paste the HTML content from MS Word or other websites. The editor cleanup the pasted HTML content by considering the following items.

  • The unformatted HTML element (MOS XML format) content to standard HTML elements.
  • The MS Office prefixed style properties is converted to proper CSS style properties.
  • The unwanted tags, CSS styles, and comments are removed from the copied content.

The following settings are available to cleanup the content in pasteCleanup settings property:

  • Select any option in Format Option drop down list for the paste content.
    • Select the Prompt option to invoke prompt dialog with paste options on pasting the content in editor.
    • Select the Plain Text option to paste the content as plain text.
    • Select the Keep Format option to keep the same format in the copied content.
    • Select the Clean Format option to remove the style format in the copied content.
  • Fill the denied tags text box to ignore the tags when pasting HTML content. For example:
    • ['a[!href]'] - paste the content by filtering anchor tags that don’t have the 'href' attribute.
    • ['a[href, target]'] - paste the content by filtering anchor tags that have the 'href' and 'target' attributes.

  • Fill the denied attributes to paste the content by filtering out these attributes from the content. For example:
      ['id', 'title'] - This will remove the attributes 'id' and 'title' from all tags.

  • Fill the allowed style properties to paste the content by accepting these style attributes and removing other attributes. For example:
      ['color', 'margin'] - This will allow only the style properties 'color' and 'margin' in each pasted element.

Injecting Module

The previous features were built as modules to be included in your application. For example, inject the 'PasteCleanup' module using RichTextEditor.Inject (Toolbar, Link, Image, Count, HtmlEditor, PasteCleanup) to use the paste cleanup feature.

Transform your ASP.NET MVC web apps today with Syncfusion ASP.NET MVC components
85+ high-performance and responsive UI components
Dedicated support
Hassle-free licensing