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

Word 2007 Formatting Not Stripped Under IE 10

1 Answer 41 Views
Editor
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 08 Jul 2014, 05:46 PM
We recently upgraded our Telerik controls to version Q1 2014 and are now having some trouble with stripping Word 2007 formatting under IE10.  You can see the problem on the Telerik demo page (http://demos.telerik.com/aspnet-ajax/editor/examples/cleaningwordformatting/defaultcs.aspx).  When I paste in some text from Word 2007 into the editor loaded on IE 10 with MSWordConvertAll I get this:

<span><strong><em><span style="font-size: 10pt; font-family: 'Verdana','sans-serif'; color: #4f81bd;"><w:Sdt id="-254595406" title="Show Link" DocPart="B1FE264F85054FCB889BE45DC801997A"><span style="font-size: 10pt; font-family: 'Verdana','sans-serif';">inconsequential, toe fractures that are improperly managed can lead to significant pain and disability. Treatment is generally straightforward, with excellent outcomes. <w:Sdt id="-254595406" title="Show Link" DocPart="07A86A9329474E549AD4270D9993B428">(<w:sdtPr></w:sdtPr><w:Sdt id="-254595403" DocPart="07A86A9329474E549AD4270D9993B428"><a href="http://localhost:4342/Graphic/Preview.aspx?graphicId=51289" title="Subacute or chronic weakness" target="_utdGraphicPreview"><span style="color: #0000ff;">algorithm 1</span></a><w:sdtPr></w:sdtPr><w:Sdt id="-254595399" DocPart="7D6DB96CCC274B7ABDF60C3ED5A7FD04" SdtTag="51289" ShowingPlcHdr="t"></w:Sdt></w:Sdt>)</w:Sdt></span></w:Sdt></span></em></strong></span>

As you can see, while the raw text is okay, the Word content controls are no longer converted, which is causing some trouble for our OnPaste handler.  Is there a setting I'm missing or is this a regression, or is this combination of Word 2007/IE 10 no longer supported?

Thanks,
David

1 Answer, 1 is accepted

Sort by
0
Ianko
Telerik team
answered on 11 Jul 2014, 08:45 AM
Hi David,

The described behavior is already discussed in an official ticked thread opened to us. In case of further assistance needed I would like to ask you to continue the conversation in the official ticket, so that we could examine the provided information more accurately.

For everyone else interested on this matter. 

This issue occurs because content controls in Word are elements that can be successfully pasted only in IE. In other browsers, they are stripped by the default pasting functionality of the browser.

In RadEditor the Clean Word Formatting functionality is not designed to detect these Word elements and it appears that in IE they show up in the HTML as tags. 

To resolve the issue you can further customize the clearInvalidHtml() method to strip undesired tags on pasting. The following example shows how to strip the <w:sdtPr> tags:
<telerik:RadEditor ID="RadEditor1" runat="server">
</telerik:RadEditor>
  
<script type="text/javascript">
    var clearInvalidHtml = Telerik.Web.UI.Editor.Utils.clearInvalidHtml;
    Telerik.Web.UI.Editor.Utils.clearInvalidHtml = function (html) {
        var cleanHtml = clearInvalidHtml.call(this, html);
        cleanHtml = cleanHtml.replace(/<\/?[w]:[^>]*?>/gi, "");
        return cleanHtml;
    }
</script>


Regards,
Ianko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Editor
Asked by
David
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Share this question
or