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

Paste from Word: format lost after post back

4 Answers 83 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Mauro
Top achievements
Rank 1
Mauro asked on 02 Feb 2011, 06:10 PM
Hi all,
we are using the new RadControl Ajax Q3 2010 SP2 and found a weird issue.
These are the steps to reproduce it:

- open up the "RadControls for ASP.NET AJAX Q3 2010 SP2 Live Examples" and choose the demo called Editor/First Look
- copy some formatted text from Word: choose a mix of left/center/right aligned sentences for your convenience. I've used the text in the attached "PasteFromWordText" image
- paste to the Editor: choosing "no" (or "Cancel") to the request to clean the formatting: the text appears the same as it appears in Word: good
- click the "HTML" button to view the html code
- click the "Design" button to go back to the text: the formatting is lost and all paragraphs are now left-aligned (see attached "pasteFromWordAfterPostback image)

In our application we don't use the "HTML" mode but the same thing happens when we post the page back (for instance to save the text to our database): I can reassure that the Content property is not manipulated by our code and after the page is refreshed, the formatting is lost.

I've already set some properties in the Editor like ContentFilters="none" and StripFormattingOptions="none" but no luck.
Any ideas?

Thanks
Mauro

4 Answers, 1 is accepted

Sort by
0
Mauro
Top achievements
Rank 1
answered on 03 Feb 2011, 10:13 AM
I forgot an important detail: this seems to happen on IE6 native or IE8 running in compatibility mode, but not on IE8 native.
I've not tried other browsers as the app I'm working on is still targeting IE6 at the moment.

This problem is quite a show stopper to us: if we can't find a solution, we'll need to revert back to the old RadEditor which didn't have this problem.

P.S.: I've submitted a support ticket to try getting a quicker response.

Thanks
Mauro
0
Dobromir
Telerik team
answered on 04 Feb 2011, 04:50 PM
Hi Mauro,

I already answered your support ticket on the subject. For convenience I will paste my answer here as well:

The problem occurs due to the fact that the MS Word formatting is not stripped upon paste. This is causing the ConvertToXhtml built-in filter to stop working properly because of the non-XHTML tags in the content.

To avoid this problem can either:
  • Strip the MS Word formatting when pasting content from word - Clicking Yes / OK on the dialog that pops-up.
  • Disable the ConvertToXhtml built-in content filter. In your initial post mentioned that you have tried setting ContentFilters to None, but could you please verify that, because after disabling the filter the content has kept its formatting on my side. You can test the built-in content filters in the following live demo:
    Editor / Built-in Content Filters


Best wishes,
Dobromir
the Telerik team
Browse the vast support resources we have to jump start 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.
0
Kamalesh Patel
Top achievements
Rank 1
answered on 08 Feb 2011, 11:06 AM
Hi,

I have tested with disableing the contentfilter property ( ConvertToXhtml ).

But preview does not looks same as pasted from word.

Vijay
0
Michael
Top achievements
Rank 1
answered on 10 Feb 2011, 12:59 PM
Quick update on this one:
we have found that the problem was caused by some weird Word tags like "<o:p>" and "</o:p>".
The suggested option to clean up the Word formatting is not applicable because the clean up process cleans up too many things, including valid formats that we believe should be preserved, so we worked around the problem doing some clean-up in the OnClientPasteHtml client event.

Maybe Telerik should look at the clean up code in "paste from word" and improve it.

I've closed the support ticked now.
Thanks
Mauro
Tags
Editor
Asked by
Mauro
Top achievements
Rank 1
Answers by
Mauro
Top achievements
Rank 1
Dobromir
Telerik team
Kamalesh Patel
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Share this question
or