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

Pasting from word with inline style

1 Answer 50 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 09 Dec 2011, 04:10 PM
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


1 Answer, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 14 Dec 2011, 03:09 PM
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
Tags
Editor
Asked by
Richard
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Share this question
or