This is a migrated thread and some comments may be shown as answers.

Is there a MSWordRemoveAll client event?

1 Answer 76 Views
Editor
This is a migrated thread and some comments may be shown as answers.
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
sitefinitysteve asked on 29 Nov 2010, 02:15 PM
I'd LOVE to be able to handle a paste event where a user pastes in some Word Content I could have a popup or a jQuery element notify them that word formatting has been stripped...does that functionality at all exist?

It's a massive pain in the ass right now in a university as EVERYONE uses word, and we get at least one "Does this not allow word documents?" question a week.

Regards,
Steve

1 Answer, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 01 Dec 2010, 01:10 PM
Hi Steve,

To achieve the required functionality you can handle the RadEditor's ClientPasteHtml, e.g.:
<telerik:RadEditor ID="RadEditor1" runat="server" OnClientPasteHtml="OnClientPasteHtml" StripFormattingOptions="MSWordRemoveAll">
</telerik:RadEditor>
 
<script type="text/javascript">
    function OnClientPasteHtml(editor, args)
    {
        //check the command raised the event
        if (args.get_commandName() == "Paste"
            || args.get_commandName() == "PasteFromWord"
            || args.get_commandName() == "PasteFromWordNoFontsNoSizes")
        {
            var stripOptionEnum = Telerik.Web.UI.StripFormattingOptions;
            var stripOption = editor.get_stripFormattingOptions();
 
            //check if RadEditor is configured to strip MSWord formatting
            if (stripOption == stripOptionEnum.MSWordRemoveAll
                || stripOption == stripOptionEnum.MSWord
                || stripOption == stripOptionEnum.MSWordNoFonts)
            {
                alert("MS Word formatting will be stripped");
                      //show custom popup
            }
        }
    }
</script>

More detailed information regarding the Client-Side API of RadEditor is available in the following help article:
Getting familiar with Client-Side API

Regards,
Dobromir
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Editor
Asked by
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Dobromir
Telerik team
Share this question
or