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

[Solved] Copy/Past from Word and firefox

2 Answers 153 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Kashif Imran
Top achievements
Rank 1
Kashif Imran asked on 12 Jan 2010, 09:20 PM
I want to allow users to copy and past text from MS word. But I also need to limit how many words they can put it.

I am doing word count using

editor.Text.WordCount(); where word count is an extension method I wrote.

I am using Text insted of Content because I dont want to count all the fomatting in word count limit. And it is working fine on IE but not with firefox because firefox is adding all the word formatting in Text property. Below is what I was getting in text property. How can I make sure that all the text from word gets pasted without loosing any formatting and still be able to force a word count?

As you can see, i only entered "This is some test text that I m going to use to test rad text editor." in the textbox and when I submitted the form, this is what I got. Also I get this only when my app on the main server. If I test it using localhost, it works fine with firefox. Any ideas?

I tried to use StripFormattingOptions="MSWord"
but then I loose the formatting.

Thanks,

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} This is some test text that I m going to use to test rad text editor.

2 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 14 Jan 2010, 03:37 PM
Hi Kashif,

Let me provide you details what is happening when pasting content from MS Word to RadEditor. The paste process is controlled entirely by the Operating System and by the browser. The editor is not allowed to interfere in this process much (of course there are some minor differences between browsers). Thus, with respect to pasting - the original MS Word formatting is not HTML. It is MS Word specific XML formatting. When this is exported to the clipboard, and is made available for paste, it "announces" what "paste flavors" it supports - and those would be MS Word, HTML, Plain text, RTF and so on.
When a client entity (such as the editor) wants to consume the content of the clipboard, it announces what paste formats it supports (and the editor - any editor - only supports plain text and HTML). So, MS Word converts the original MS Word to HTML, and this process is controlled entirely by MS Word, and not at all possible to interfere by the editor. Please, note that all Word formatting is converted to a global style tag in Firefox - this behavior is not controlled by RadEditor as well.
For some reason the content of this style tag is returned by the RadEditor's Text property on your side.

Is it possible that you use an older version of RadEditor but not the latest one (2009.3 1208)?

I made a test with the latest version of RadEditor in Firefox and I was unable to reproduce "the extra styles in the content" problem returned by the Text property. For your convenience I have attached a video demonstrating my test.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kashif Imran
Top achievements
Rank 1
answered on 01 Feb 2010, 12:06 AM
Thanks Rumen,

I updated to current version i.e. 2009.3.1314.35 and that fixed the problem. Earlier I was using August 2009 build and RadEditor in that build has issues with Firefox.


Tags
Editor
Asked by
Kashif Imran
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Kashif Imran
Top achievements
Rank 1
Share this question
or