# rich-text-editor-paste-from-ms-word

> Rich text editor configured to clean and preserve formatting when pasting content from Word.

**Framework:** aspnet-core  **Component:** RichTextEditor  **Variant:** paste-from-ms-word

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/aspnet-core/rich-text-editor-paste-from-ms-word.json
```

**Install Package(s)**

```bash
dotnet add package Syncfusion.AspNetCore.RichTextEditor
dotnet add package Syncfusion.AspNetCore.Inputs
dotnet add package Syncfusion.AspNetCore.DropDowns
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/rich-text-editor-paste-from-ms-word/rich-text-editor.cshtml

```cshtml
@page
@namespace aspnet_core.RichTextEditor.PasteFromMsWord
@model EJ2CoreSampleBrowser.RichTextEditor.PasteFromMsWord.PasteFromMsWordModel
@using Syncfusion.EJ2
@using Syncfusion.EJ2.DropDowns

    <div class="control-section">
        <div class="content-wrapper" id="all-option-sample">
            <div class="col-lg-8">
                <ejs-richtexteditor id="pasteCleanUp">
                    <e-richtexteditor-pastecleanupsettings prompt="true"></e-richtexteditor-pastecleanupsettings>
                    <e-content-template>
                        <h4>Paste Cleanup in Rich Text Editor</h4>
                        <p>The Rich Text Editor can clean up formatted content when you paste from Word, Google Docs, or web pages.</p>
                    </e-content-template>
                </ejs-richtexteditor>
            </div>
            <div class="col-lg-4 property-section">
                <table id="property" title="Properties">
                    <tr>
                        <td><div>Format Option</div></td>
                        <td>
                            <ejs-dropdownlist id="formatOption" dataSource="@Model.Options" index="0" popupHeight="200px" change="formatChange">
                                <e-dropdownlist-fields text="Format" value="Id"></e-dropdownlist-fields>
                            </ejs-dropdownlist>
                        </td>
                    </tr>
                    <tr>
                        <td><div>Denied Tags</div></td>
                        <td>
                            <ejs-textbox id="deniedTags" placeholder="img[!href]" blur="deniedTagsChange"></ejs-textbox>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>

    <script>
        var rteObj;
        document.addEventListener('DOMContentLoaded', function () {
            rteObj = document.getElementById('pasteCleanUp').ej2_instances[0];
        });
        function formatChange(args) {
            var value = args.value;
            if (value === 'Prompt') { rteObj.pasteCleanupSettings.prompt = true; }
            else if (value === 'Plain Text') { rteObj.pasteCleanupSettings.prompt = false; rteObj.pasteCleanupSettings.plainText = true; }
            else if (value === 'Keep Format') { rteObj.pasteCleanupSettings.prompt = false; rteObj.pasteCleanupSettings.plainText = false; rteObj.pasteCleanupSettings.keepFormat = true; }
            else if (value === 'Clean Format') { rteObj.pasteCleanupSettings.prompt = false; rteObj.pasteCleanupSettings.plainText = false; rteObj.pasteCleanupSettings.keepFormat = false; }
        }
    </script>

```

### src/components/rich-text-editor-paste-from-ms-word/rich-text-editor.cshtml.cs

```cs
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.RazorPages;

namespace EJ2CoreSampleBrowser.RichTextEditor.PasteFromMsWord
{
    public class PasteFromMsWordModel : PageModel
    {
        public List<FormatOption> Options { get; set; }

        public void OnGet()
        {
            Options = new List<FormatOption>
            {
                new FormatOption { Id = "Prompt",        Format = "Prompt" },
                new FormatOption { Id = "Plain Text",   Format = "Plain Text" },
                new FormatOption { Id = "Keep Format",  Format = "Keep Format" },
                new FormatOption { Id = "Clean Format", Format = "Clean Format" },
            };
        }
    }

    public class FormatOption
    {
        public string Id { get; set; }
        public string Format { get; set; }
    }
}

```
