Problem with Rad Editor on paste to keep MS Word formatting

12 posts, 0 answers
  1. Afroz khan
    Afroz khan avatar
    38 posts
    Member since:
    Dec 2009

    Posted 25 Sep 2013 Link to this post

    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
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 25 Sep 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Afroz khan
    Afroz khan avatar
    38 posts
    Member since:
    Dec 2009

    Posted 25 Sep 2013 Link to this post

    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.

  5. Shailesh
    Shailesh avatar
    3 posts
    Member since:
    Aug 2013

    Posted 19 Dec 2013 Link to this post

    Hi Marin,

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



    Regards
    Shailesh Naik




  6. Shailesh
    Shailesh avatar
    3 posts
    Member since:
    Aug 2013

    Posted 19 Dec 2013 Link to this post

    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
  7. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 20 Dec 2013 Link to this post

    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.
  8. Ravi
    Ravi avatar
    1 posts
    Member since:
    Jun 2015

    Posted 17 Jun 2015 in reply to Marin Bratanov Link to this post

    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

  9. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 18 Jun 2015 Link to this post

    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
  10. Arun
    Arun avatar
    2 posts
    Member since:
    Oct 2015

    Posted 07 Oct 2015 in reply to Marin Bratanov Link to this post

    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.

  11. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 08 Oct 2015 Link to this post

    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
  12. Sajid
    Sajid avatar
    1 posts
    Member since:
    Jul 2016

    Posted 03 Jul in reply to Marin Bratanov Link to this post

    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 />

     

     

  13. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 04 Jul Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017