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

Paste from Word not working after paste from IE edit menu

3 Answers 138 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Augusto
Top achievements
Rank 1
Augusto asked on 06 Jan 2009, 09:16 AM
Hello.

I'm using Telerik RadEditor 7.3.2.0 and I have the following problem.

I have a text in MS Word with TimeRoman 11 font. I have initialized RadEditor with 

Editor.StripFormattingOnPaste =

EditorStripFormattingOptions.MSWordRemoveAll

 

and the unique font is Arial 14.

When I copy the text in from MS-Word and I paste it into the Editor with the Paste from Word button, it works fine. The text is converted to Arial 14.
Right after that I paste using the IE Edit / Paste menu item and the text is appended to the previous block but with font TimesRoman 11.
Then I paste again with the Paste from Word button and the text is pasted as TimesRoman instead of Arial.

It seems that after a paste from outside the editor (IE menu item), the Paste from Word does not clear the font settings.

1. How can we avoid this situation ?
2. Is it a way to apply the FormattingOptions even if the paste action is coming from the IE menu ?

Thanks for your help.
Regards
Augusto

3 Answers, 1 is accepted

Sort by
0
Svetlina Anati
Telerik team
answered on 09 Jan 2009, 10:20 AM
Hi Augusto,

As far as I can see from the mentioned version of the RadEditor control you are using the RadEditor for ASP.NET and not RadEditor for ASP.NET AJAX. If so, please note that you should select the RadEditor for ASP.NET from the Product dropdown.

I am not quite sure what exactly you want the final result to be but I believe that the following information will be helpful:

  1. If you want to have all the content with stripped formatting (including fontname, etc.) you should use:

     - Editor.StripFormattingOnPaste = EditorStripFormattingOptions.MSWordRemoveAll
     - the tool you should use for the paste is:  PasteFromWordNoFontsNoSizes
  2. If you want to keep the font you should use:

     - Editor.StripFormattingOnPaste = EditorStripFormattingOptions.MSWord
     - the tool you should use for the paste is:  PasteFromWord

You can test this in the following online demo:

http://demos.telerik.com/aspnet-ajax/Editor/Examples/CleaningWordFormatting/DefaultCS.aspx

The demo is for RadEditor for ASP.NET AJAX but especially the pasting algorithms are the same for RadEditor for ASP.NET and for RadEditor for ASP.NET AJAX and the demo is capable for testing in your case.

Regards,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Augusto
Top achievements
Rank 1
answered on 09 Jan 2009, 10:39 AM
Svletina,

Thanks for your reply.
Actually I'm doing exactly like you explain in your reply.
May be what was not clear in my question is the fact that I have define a unique font and size (Arial 14) so that users can't chose another font and size.

In the ToolsFile.xml I have

  <fontNames>
    <item name="Arial" />
  </fontNames>
...
  <realFontSizes>
    <item value="14pt"></item>
  </realFontSizes>

The Paste from Word with the option MSWordRemoveAll  works until I paste from using the IE Edit / Paste menu item. The text is pasted in orginal Word fonts and size (not Arial). The right after when I paste with the Paste from Word tool, the text is displayed with the original Word fonts. I would like the text to be Arial 14.

The question is why does not the Editor apply the Arial 14 font after a text has been pasted with the IE Edit / Paste menu ?

I hope this can help you understand my problem.

Thanks for your help.
Regards
Augusto
0
Rumen
Telerik team
answered on 13 Jan 2009, 02:05 PM
Hi Augusto,

In order to do the paste process, the editor takes over the paste when the paste command is fired and redirects the paste to the hidden container in which the content is cleaned and then pasted back into the content area.

However the security in Internet Explorer 7 was tighten and a browser alert would appear saying that the editor is attempting to access the content. This was not very user friendly and thus we had to rework the mechanism to rely on the onbeforepaste browser event. However as it turns out the onbeforepaste event is fired in an number of situations that have nothing to do with pasting.
Unfortunately, the onbeforepaste event fires for example when the browser checks the state of the paste command and also when displaying the default browser context menu (which also has a paste command).  The problem arises because IE7 calls pointlessly the onbeforepaste event when is clicked the page menu, and we cannot pinpoint whether this call is caused by real case event or not.

As a workaround I would suggest stripping the Word formatting on submit as it is shown in the following help article: Cleaning Word Formatting On Page Load And On Submit.

You can strip the word formatting and font family and size information by setting WORD_ALL as a value for the FormatStripper, e.g.

editor.fire("FormatStripper", {value : "WORD_ALL"});

 The possible options are All, ALL_NO_BRAKES, CSS, WORD, WORD_ALL, WORD_NO_FONTS, SPAN.

Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Augusto
Top achievements
Rank 1
Answers by
Svetlina Anati
Telerik team
Augusto
Top achievements
Rank 1
Rumen
Telerik team
Share this question
or