Pasting from word with inline style

2 posts, 0 answers
  1. Richard
    Richard avatar
    14 posts
    Member since:
    Apr 2011

    Posted 09 Dec 2011 Link to this post

    I am trying to paste some code into a RadEditor control from Word.

    If I paste it into another application like Dreamweaver, it includes a <style> section when I view the HTML, like this:

    <style type="text/css">
    <!--
    p.MsoNormal {
    margin:0cm;
    margin-bottom:.0001pt;
    font-size:12.0pt;
    font-family:"Cambria","serif";
    }
    p.MsoListParagraphCxSpLast {
    margin-top:0cm;
    margin-right:0cm;
    margin-bottom:.0001pt;
    margin-left:36.0pt;
    font-size:12.0pt;
    font-family:"Cambria","serif";
    }
    span.MsoHyperlink {
    color:blue;
    text-decoration:underline;
    text-underline:single;
    }
    -->
    </style>

    If I paste it into the RadEditor control and look at the HTML, it includes everything apart from the <style> section. This means that some of the formatting defined in the <style> is not shown.

    If I manually paste this section using the HTML editor in the RadEditor control it looks fine. However, the people who will be using the system are not technical enough to do this.

    Is it possible to configure an option to include this when it is pasted (or if not, configure Word so that it applies they styling to the text elements itself rather than using inline CSS when you copy from it)?

    Thanks, Richard


  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 14 Dec 2011 Link to this post

    Hi Richard,

    This issue is not directly related to RadEditor but is a default browser / OS behavior - RadEditor's content area is an editable <iframe> and its functionality is based on the browser's default RichTextEditing engine. You can observe the same behavior using a standard editable <iframe> element. In this forum post you can find detailed explanation how the Paste is handled.

    By default, RadEditor do strip some of the content that is provided by MS Word when pasting to remove non-XHTML tags. You can disable this behavior by setting RadEditor's StripFormattingOptions to NoneSupressCleanMessage, e.g.:
    <telerik:RadEditor ID="RadEditor1" runat="server" StripFormattingOptions="NoneSupressCleanMessage">
    </telerik:RadEditor>


    All the best,
    Dobromir
    the Telerik team
    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 their blog feed now
Back to Top