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

Strange Characters When Trying To Strip Font Tags

1 Answer 89 Views
Sharepoint Integration
This is a migrated thread and some comments may be shown as answers.
David Gottlieb
Top achievements
Rank 1
David Gottlieb asked on 10 Aug 2007, 08:43 PM
We have implemented the Sharepoint RadEditor control on our site and we are seeing some strange behavior when pasting from Microsoft Word.

When we paste from Word and tell it Yes to remove all Word formatting, it seems to work fine. However, when we choose the Format Stripper and choose the Font Tags option to remove all Font Tags, the text that then appears seems to be something like Greek text or something. It looks normal when you view the HTML view but in design view, it looks like Greek text. The only way I know to get rid of that is to first strip all Span tags, then strip all Cascading Style Sheets. At that point I can strip all Font Tags and it works.

I am copying from Word 2007. Could that be the issue? Is this a known thing?

Thanks,

David

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 13 Aug 2007, 09:56 AM
Hi David,

Regarding my experience with pasting from Word, I know that the shape of the bulleted lists content is set by wrapping the symbol inside a Symbol font, which when pasted in RadEditor is not stripped and thus the content wrapped in Symbol font is displayed with Greek letters. I believe that in your scenario, the Word content pasted in RadEditor has Symbol font.

Here is a sample code that will parse the MS Word content when pasted and will clean the Symbol fonts:

<radE:RadEditor ID="RadEditor1" runat="server"></radE:RadEditor>
<script type="text/javascript">
var old = RadEditorNamespace.StripWordFormatting;
RadEditorNamespace.StripWordFormatting = function(html, clearValue)
{
    var result = old(html, clearValue); 
    var fontCleaner = /(\<span style=\"[a-z\-\:\s0-9\;]*)(font-family\s*\:\s*Symbol)/ig; 
    var newContent = result.replace(fontCleaner,"$1"); 
    return newContent;
}
</script>

I hope this helps.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Sharepoint Integration
Asked by
David Gottlieb
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or