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

Problem with Rad Editor on paste to keep MS Word formatting

11 Answers 467 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Afroz khan
Top achievements
Rank 1
Afroz khan asked on 25 Sep 2013, 01:57 PM

Hi ,

There is a problem in MS Word formatting during  paste when user click on Cancel and there is formatted text to paste then issue appear and shows some extra tags like “<st1:placename w:st="on">” ,
</st1:address></st1:street>  etc and formatting gets destructed.

Could you please look into why when we hit on Cancel and then save the record, garbage tags are appeared to destruct the text formattng?

Please see the attached snapshot too

11 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 25 Sep 2013, 02:31 PM
Hi Afroz,

The dialog you see asks if you want RadEditor to remove these additional tags MS Word uses. If you click OK RadEditor will convert them to HTML. If you click cancel you will get the text MS Word provides, which includes these tags. You get the expected behavior when you cancel the cleaning operation.


If you want to avoid having that dialog you can define MS Word pasting options in the RadEditor settings so that it fits your needs. Generally, the less content you strip, the closer both documents will be, but the HTML will get lenghty. This is why we offer a set of options that can control this. More details and a way to test it is available in the following demo: http://demos.telerik.com/aspnet-ajax/editor/examples/cleaningwordformatting/defaultcs.aspx.


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.
0
Afroz khan
Top achievements
Rank 1
answered on 25 Sep 2013, 02:38 PM
Hi Marin,

Thanks
But I want to keep MS Word Formatting option also want to know the root cause why  "<st1:placename w:st="on">” , </st1:address></st1:street>" etc  tags are appearing when i click on Cancel.

0
Shailesh
Top achievements
Rank 1
answered on 19 Dec 2013, 10:23 AM
Hi Marin,

Do these options are available for old version (Rad Editor) as well?



Regards
Shailesh Naik




0
Shailesh
Top achievements
Rank 1
answered on 19 Dec 2013, 10:37 AM
Hello,

In my case happening same, when pasting in Editor message comes to clean word formatting I used both the options (Ok,Cancel) but getting same text for both.

 I want to keep option OK as a default (means it should remove unwanted formatting).

Can anyone please tell solution on this ?


Regards
Shailesh
0
Marin Bratanov
Telerik team
answered on 20 Dec 2013, 05:28 PM
Hi Shailesh,

Have you examined the demo I linked in my previous response to this thread: http://demos.telerik.com/aspnet-ajax/editor/examples/cleaningwordformatting/defaultcs.aspx? When the StripFormattingOnPaste or StripFormattingOptions property is set (they are equivalent, but you should use StripFormattingOptions), this dialog from the screenshot is suppressed and the value of the property determines what content is removed. Here is a sample editor that produces nice, clean HTML without much visual formatting:
<telerik:RadEditor ID="RadEditor1" Width="600px" runat="server" Height="800px" NewLineMode="P"
    StripFormattingOptions="MSWordNoMargins, MSWordNoFonts, Css, Font, ConvertWordLists">
</telerik:RadEditor>

You may want to remove the Css and Font properties to keep colors and fonts from Word.

Perhaps a point of interest is that when ContentAreaMode=DIV with Chrome and Firefox a paste dialog will be shown because with an editable div these browsers do not exposes the needed paste events.

As for old versions - this property has been available for a long time, yet major improvements were made in Q1 2013 (http://blogs.telerik.com/aspnet-ajax/posts/13-04-17/seamless-paste-from-word-with-the-improved-telerik-asp.net-editor), so I strongly advise that you upgrade to the latest version.

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.
0
Ravi
Top achievements
Rank 1
answered on 17 Jun 2015, 11:47 AM

Hi Marin,

I am using Telerik rich text editor control in our web application with version having 2014.1.403.40

The problem is when i am pasting a text in editor with the option "   StripFormattingOnPaste="MSWord" from the word document, it loses the font settings. 

 

Please let me know how can i preserve this?

 

Regards

Ravi

0
Marin Bratanov
Telerik team
answered on 18 Jun 2015, 03:21 PM

Hi Ravi,

You can test the settings combination that works best for your case in the following demo: http://demos.telerik.com/aspnet-ajax/editor/examples/cleaningwordformatting/defaultcs.aspx.

For example, a combination of MSWordNoMargins and ConvertWordLists should give you just about all of the formatting available in MS Word. Here is a short video: http://screencast.com/t/Qy0t3b17Az.

Regards,

Marin Bratanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Arun
Top achievements
Rank 1
answered on 07 Oct 2015, 08:21 PM

Hi,

In MSWord i have a text with Font-Family : Calibri, Font-Size:14px

In the Rad Editor text box I copy & pasted that text, then selected th​at.

I see in the Editor Tool DropDown  font-family is good, but font-size is getting changed to 19px .

May i know why?   is there any fix for that?

FYI: if i see the same in html view it looks good. only in Editor tool DropDown it shows the wrong font-size & it is confusing.

0
Marin Bratanov
Telerik team
answered on 08 Oct 2015, 10:35 AM

Hello Arun,

The 14pt value from MS Word is equivalent to 19px and this is what RadEditor shows. This is the same in all browsers and our scripts calculate that value. Otherwise, IE would show the value in pt and all other browsers would show the value in px themselves which would cause inconsistent behavior in our control.

Regards,

Marin Bratanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Sajid
Top achievements
Rank 1
answered on 03 Jul 2016, 10:50 AM

Hi Marin,

Pasting from word is not working in Firefox , not even in your demo site. try with bullets.following is the html generated from bullets

&bull;&nbsp;&nbsp; &nbsp;A<br />
&bull;&nbsp;&nbsp; &nbsp;B<br />
&bull;&nbsp;&nbsp; &nbsp;C<br />
&bull;&nbsp;&nbsp; &nbsp;D<br />
&bull;&nbsp;&nbsp; &nbsp;E<br />
&bull;&nbsp;&nbsp; &nbsp;F<br />
<br />

 

 

0
Marin Bratanov
Telerik team
answered on 04 Jul 2016, 08:38 AM

Hi Sajid,

I advise you review the following article to see how pasting in RadEditor works: http://docs.telerik.com/devtools/aspnet-ajax/controls/editor/managing-content/pasting-content/overview.

I also advise that you test with the attached simple editable iframe, because RadEditor does not control the content, it comes from the browser. RadEditor can only clean up invalid markup coming from MS Word.

Considering the HTML I see, the issue is probably with the MS Word document. It is very likely that the bullets are merely bullet characters pasted in lines of text (not even in paragraphs), and not a real bullet list.

Regards,

Marin Bratanov
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
Editor
Asked by
Afroz khan
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Afroz khan
Top achievements
Rank 1
Shailesh
Top achievements
Rank 1
Ravi
Top achievements
Rank 1
Arun
Top achievements
Rank 1
Sajid
Top achievements
Rank 1
Share this question
or