I have several people that do pasting from Word in to RadEditors. When they do, they get a dialog box:
The content you are trying to paste has MS Word formatting.Would you like to clean it?
They are given two options, which are OK and Cancel. When you click OK, everything's fine. When you click cancel, text still pastes in. I assume that this is because Cancel in this case means "no, I do not want to clean it, just paste it in." Am I correct?
If so, here's the real issue: we do not want people to able to bypass this cleaning (basically, force them to click OK every time). I assume it's possible to force it with Javascript, but I need to know which event is fired in this case. Is it OnClientPasteHtml? (http://www.telerik.com/help/aspnet-ajax/editor-onclientpastehtml.html)
Thanks,
Chris Aumiller
The content you are trying to paste has MS Word formatting.Would you like to clean it?
They are given two options, which are OK and Cancel. When you click OK, everything's fine. When you click cancel, text still pastes in. I assume that this is because Cancel in this case means "no, I do not want to clean it, just paste it in." Am I correct?
If so, here's the real issue: we do not want people to able to bypass this cleaning (basically, force them to click OK every time). I assume it's possible to force it with Javascript, but I need to know which event is fired in this case. Is it OnClientPasteHtml? (http://www.telerik.com/help/aspnet-ajax/editor-onclientpastehtml.html)
Thanks,
Chris Aumiller
6 Answers, 1 is accepted
0
Richard
Top achievements
Rank 1
answered on 09 Feb 2012, 03:12 PM
Chris:
You can mandate the behavior of RadEditor by manipulating the settings of the StripFormattingOnPaste property declaritively.
If you set StripFormattingOnPaste="MSWordRemoveAll" the popup is bypassed and all Word formatting is stripped.
The online demo: Editor/Cleaning Word Formatting demonstrates all of the options that can be set in the RadEditor to customize behavior.
Cheers!
You can mandate the behavior of RadEditor by manipulating the settings of the StripFormattingOnPaste property declaritively.
If you set StripFormattingOnPaste="MSWordRemoveAll" the popup is bypassed and all Word formatting is stripped.
The online demo: Editor/Cleaning Word Formatting demonstrates all of the options that can be set in the RadEditor to customize behavior.
Cheers!
0
Chris
Top achievements
Rank 1
answered on 09 Feb 2012, 05:22 PM
If I've been reading this right, though, not all browsers support the OnPaste event that triggers it. Am I correct?
Thanks,
Chris
Thanks,
Chris
0
Richard
Top achievements
Rank 1
answered on 09 Feb 2012, 06:07 PM
Chris:
I believe that there is cross-browser support for the OnPaste event, but it is handled differently by browsers. See the onpaste event | paste event reference article for insights.
The alternative approach is defined in the above mentioned Editor/Cleaning Word Formatting demo:
Formatting can also be stripped automatically on page submit for browsers that do not provide onpaste event using the OnClientSubmit event and FormatStripper command of RadEditor, e.g.
<script type="text/javascript">
function OnClientSubmit(editor)
{
editor.fire("FormatStripper", {value : "WORD"});
}
</script>
<telerik:RadEditor runat="server" OnClientSubmit="OnClientSubmit"/>
Cheers!
I believe that there is cross-browser support for the OnPaste event, but it is handled differently by browsers. See the onpaste event | paste event reference article for insights.
The alternative approach is defined in the above mentioned Editor/Cleaning Word Formatting demo:
Formatting can also be stripped automatically on page submit for browsers that do not provide onpaste event using the OnClientSubmit event and FormatStripper command of RadEditor, e.g.
<script type="text/javascript">
function OnClientSubmit(editor)
{
editor.fire("FormatStripper", {value : "WORD"});
}
</script>
<telerik:RadEditor runat="server" OnClientSubmit="OnClientSubmit"/>
Cheers!
0
Hi,
Indeed, Opera still does not offer onpaste event and for this reason the StripFormattingOptions does not function under it. You can instruct your clients to use the Paste from Word dialog to strip the formatting and / or strip the content on submit.
Best regards,
Rumen
the Telerik team
Indeed, Opera still does not offer onpaste event and for this reason the StripFormattingOptions does not function under it. You can instruct your clients to use the Paste from Word dialog to strip the formatting and / or strip the content on submit.
Best regards,
Rumen
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Naga
Top achievements
Rank 1
answered on 23 Sep 2013, 03:44 PM
pasting from word, it will ask message : The content you are trying to paste has MS Word formatting.Would you like to clean it ?
If I click on ok, I want to be clear all styles from Word,
If I click on cancle, it will paste as it is from word.
please let me know how can we solve this problem while pasting the text from MS word.
Thanks,
Naga.
If I click on ok, I want to be clear all styles from Word,
If I click on cancle, it will paste as it is from word.
please let me know how can we solve this problem while pasting the text from MS word.
Thanks,
Naga.
0
Hi Naga,
This is not a problem, but the expected behavior. You can read my detailed explanation on the case here: http://www.telerik.com/community/forums/aspnet-ajax/editor/problem-with-rad-editor-on-paste-to-keep-ms-word-formatting.aspx#2802202.
Regards,
Marin Bratanov
Telerik
This is not a problem, but the expected behavior. You can read my detailed explanation on the case here: http://www.telerik.com/community/forums/aspnet-ajax/editor/problem-with-rad-editor-on-paste-to-keep-ms-word-formatting.aspx#2802202.
Regards,
Marin Bratanov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.