Home Search Member List Faq Register Login  
UltimateEditor
Re: Pasting from Word document corrupts content

Thread Starter: Otonashi Meru   Started: 07-06-2009 3:55 AM   Replies: 10
 Karamasoft Support Forums » General Discussions » UltimateEditor » Re: Pasting from Word document corrupts content
 Printable Version    « Previous Thread   Next Thread »
  06 Jul 2009, 3:55 AM
Otonashi Meru is not online. Last active: 1/4/2010 6:20:38 AM Otonashi Meru

Top 10 Posts
Joined on 01-20-2009
Posts 12
Pasting from Word document corrupts content
Hi,

When I copy and paste from this word document into UltimateEditor I get a lot of errors:

https://www.yousendit.com/download/cmcwSU5GSWhwTVdGa1E9PQ


Text is moved around, truncated, inserted in the wrong place, html code appears in the document, large parts of text become bold for no reason etc. This is happening on the sample editor on your site when spell as you type is set on. With spell as you type off the problems go away. Is there any way to prevent this without turning off spell as you type?

Thanks,

Thomas

  
  06 Jul 2009, 10:52 AM
Karamasoft is not online. Last active: 9/2/2010 12:02:18 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 5,325
Re: Pasting from Word document corrupts content
We tried pasting your sample Word document content into our live demo at http://www.karamasoft.com/Samples.aspx?component=UltimateEditor and didn't experience any issues. Have you tried it in our online demo or in your web app? Are you using the latest version of UltimateEditor? Thanks.
  
  07 Jul 2009, 2:07 AM
Otonashi Meru is not online. Last active: 1/4/2010 6:20:38 AM Otonashi Meru

Top 10 Posts
Joined on 01-20-2009
Posts 12
Re: Pasting from Word document corrupts content
I first saw it in our web app (which uses the latest version) but I checked on the your online demo and got the same behavoiur. I've investigated some more and I see that I get different results depending on browser used. IE6, which is what I was using initially, produces this result for me on your site:

https://www.yousendit.com/download/cmcySkhVdGpYSHlGa1E9PQ

You need to make sure spell as you type is on, wait a second or two for it to spell check, then scroll down to where the spelling 'errors' are. Firefox & Opera don't have any problems at all, presumably because spell as you type is disabled.

Thanks,

Thomas

  
  07 Jul 2009, 2:58 PM
Karamasoft is not online. Last active: 9/2/2010 12:02:18 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 5,325
Re: Pasting from Word document corrupts content
We tried your sample Word document in IE6 in our live demo but still couldn't reproduce the issue. When you paste the content, do you click on OK or Cancel in Clean Word Format prompt? Does it make any difference if you click OK or Cancel? If clicking OK prevents the issue, you can try setting the AutoCleanWordFormatOnPaste property of your UltimateEditor control to True to prevent the confirmation box and clean the Word format automatically.
  
  08 Jul 2009, 7:05 AM
nbaker is not online. Last active: 5/5/2010 9:55:14 AM nbaker

Top 10 Posts
Joined on 04-29-2009
Posts 13
Re: Pasting from Word document corrupts content

The corruption occurs whether you click ok or cancel or even if you just paste plain text. However the corruption seems to appear in a different place when you click ok to "clean word formatting" perhaps because the spell checker and "clean word formatting" are both editing the HTML at the same time.

If I paste a paragraph as plain text by pasting it into notepad first then I still get the corruption but it always appears in the same place. Try pasting the following (between the lines) into notepage and then copy and paste it into the live demo:

_______________________________________________________________________

North Korea:   The North celebrated US Independence Day by launching seven ballistic missiles from the east coast field site at Kittaeryong.  South Korean authorities said five were SCUD short range ballistic missiles, but two others might have been No Dong medium range ballistic missiles. 

The launches also violate UN Security Council resolutions banning missile launches. Thus they are not surprise but they are acts of defiance.

International press experts commented that the tactical significance of the SCUD launches is that they all landed in the Sea of Japan close to each other signifying improved accuracy.  (The missile system is 60 years old as a Soviet system. North Korea has had Scuds for about 30 years. Presumably even the North Korean engineers have worked out any bugs in their versions of the system.)  One news outlet described them as a “salvo.” 

_______________________________________________________________________

"Kittaeryong" is identified as a spelling mistake and is highlighted as such. The word and highlighting is also duplicated in the third paragraph.

This does not happen however if "Spell As You Type" is disabled when you paste. If I switch spell as you type off in the toolbar, paste the text and then switch spell as you type back on again. The document is spell checked successfully without any corruption occurring. That suggests to me that the spell checking is clashing with the paste operation.



  
  09 Jul 2009, 3:38 AM
nbaker is not online. Last active: 5/5/2010 9:55:14 AM nbaker

Top 10 Posts
Joined on 04-29-2009
Posts 13
Re: Pasting from Word document corrupts content

Additionally on IE8 and IE7 if I paste the following (between the lines) from notepad into your Word-like Spelling demo:

____________________________________________________________________

International press experts commented that the tactical significance of the SCUD launches is that they all landed in the Sea of Japan close to each other signifying improved accuracy.  (The missile system is 60 years old as a Soviet system. North Korea has had Scuds for about 30 years. Presumably even the North Korean engineers have worked out any bugs in their versions of the system.)  One news outlet described them as a “salvo.” 

The North has not demonstrated the capability to fire multiple missiles nearly simultaneously, i.e., in a salvo. That is not as easy as it might seem. For example, an analysis of China’s short range ballistic missile threat to Taiwan found that an effective ballistic missile attack would require 100 missiles with conventional explosive warheads to be fired in at least 8 to 10 salvos.

____________________________________________________________________

I get the following (between the lines) HTML (</P> after the first two characters and <P style... at the bottom!):

____________________________________________________________________

In</P>
<P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">ternational press experts commented that the tactical significance of the SCUD launches is that they all landed in the Sea of Japan close to each other signifying improved accuracy.&nbsp; (The missile system is 60 years old as a Soviet system. North Korea has had Scuds for about 30 years. Presumably even the North Korean engineers have worked out any bugs in their versions of the system.)&nbsp; One news outlet described them as a “salvo.”&nbsp; </P>
<P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">The North has not demonstrated the capability to fire multiple missiles nearly simultaneously, i.e., in a salvo. That is not as easy as it might seem. For example, an analysis of China's short range ballistic missile threat to Taiwan found that an effective ballistic missile attack would require 100 missiles with conventional explosive warheads to be fired in at least 8 to 10 salvos. <BR></P>
<P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px">

____________________________________________________________________


  
  09 Jul 2009, 3:55 PM
Karamasoft is not online. Last active: 9/2/2010 12:02:18 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 5,325
Re: Pasting from Word document corrupts content
We fixed this issue but haven't published the new release on our website yet. We will send you the patch shortly.
  
  21 Jul 2009, 2:50 AM
nbaker is not online. Last active: 5/5/2010 9:55:14 AM nbaker

Top 10 Posts
Joined on 04-29-2009
Posts 13
Re: Pasting from Word document corrupts content

I think I've got to the bottom of the issue of the pasted text being corrupted when spell as you type is enabled in the toolbar.

There are two Paste event handlers:

UltimateSpell.ayt.js adds the following event handler:

   AddEventHandler(usd2v.body, 'paste', function(usd5u)...

UltimateEditor.js adds the following event handler:
   
   uee63(uev8.body, 'paste', function(ueo1) { UltimateEditors[ue7m].ued42(ueo1); });

Normally the UltimateSpell one is added first followed by the UltimateEditor one. When a user pastes into UltimateEditor the Spell As You Type is paused, the text is updated and then Spell As You Type is restarted.

However when the page is more complicated (e.g. AJAX toolkit modal popups, JQuery.UI, etc) the order of the event handlers can get messed up and the UltimateEditor event handler gets added first followed by the UltimateSpell one. When a user pastes into UltimateEditor a Spell Check is initiated before the Spell As You Type is paused, when the paste operation is completed SpellAsYouType is restarted and seems to process both the Spell Check responses from it's own spell check request and those that were fired off by the earlier spell check (before the pause).

Therefore, depending on performance the first one or two chunks of text that are sent to the spell checking web services are sent and received twice and this means that any spelling mistakes are inserted in both the correct place and further down the document.


  
  21 Jul 2009, 1:26 PM
Karamasoft is not online. Last active: 9/2/2010 12:02:18 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 5,325
Re: Pasting from Word document corrupts content
Have you tired the new code that we sent you yet? According to the specs at http://msdn.microsoft.com/en-us/library/ms536343(VS.85).aspx "If you attach multiple functions to the same event on the same object, the functions are called in random order, immediately after the object's event handler is called" so there is nothing we can do on that end. The new code restarts the spell check process instead of checking the spelling only on the pasted text, which fixed the issue in our test environment. You can try setting the default value of SpellAsYouType feature to False and let your users turn it on on-demand if you have very complex page structure causing the event sequence out of order. Please visit our Spell On Demand sample at http://www.karamasoft.com/Samples.aspx?component=UltimateEditor&sample=SpellOnDemand.
  
  29 Jul 2009, 5:08 AM
Otonashi Meru is not online. Last active: 1/4/2010 6:20:38 AM Otonashi Meru

Top 10 Posts
Joined on 01-20-2009
Posts 12
Re: Pasting from Word document corrupts content
Please excuse the delay. We have it working fine now. Thanks for the assistance.
  
  30 Jul 2009, 7:25 PM
jobejufranz is not online. Last active: 10/12/2009 8:48:47 PM jobejufranz

Top 10 Posts
Joined on 03-11-2009
Posts 52
Re: Pasting from Word document corrupts content
Hi Otonashi Meru,

I just want to ask on how did you managed to fix the error? Did you use Karamasoft patch? You downloaded the latest version? Or have you done anything on your coding?

Hope you could advice, as i am having this error on my side also.

Thanks.

  
 Page 1 of 1 (11 items)
Karamasoft Support Forums » General Discussions » UltimateEditor » Re: Pasting from Word document corrupts content

You can add attachments
You can post new topics
You can reply to topics
You can delete your posts
You can edit your posts
You can create polls
You can vote in polls
Forum statistics are enabled
Forum is unmoderated

© 2002-2010 Karamasoft LLC. All rights reserved.