Word Documents all Greek (of sorts) after format cleaning

11 posts, 0 answers
  1. Clive Atkins
    Clive Atkins avatar
    14 posts
    Member since:
    Jul 2007

    Posted 22 Oct 2007 Link to this post


    Word Documents all Greek (of sorts) after format cleaning

    Dear Support,

    I have this very odd behaviour when I copy and paste a word document into the Telerik RAD Editor control v7.1.1. If I agree to the "Do you want to clean it?" dialogue then it will translate the document (which seems to resemble Greek of sorts?) with the first instance of a bullet point.

    Is this a bug? Configuration issue? Or does it have something to do with the symbol font for the bullet point?

    Any feedback would be most grateful.

    Cheers.

    Regards,
    Keith.
  2. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 23 Oct 2007 Link to this post

    Hi Keith,

    When you paste bulleted content from Word in the editor, sometimes the bullets are not supplied by the clipboard as <UL> tags but like symbols with a SYMBOL FONT, which makes the text to appear with Greek symbols.
    Basically the shape of the bulletted list is set by wrapping the symbol inside a Symbol font, which when pasted in RadEditor is not stripped and thus the content wrapped in it is displayed with Greek letters.

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

    <radE:RadHtmlField id="Content" FieldName="PublishingPageContent"  runat="server"/>
    <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>

    You  can also customize the regular expression in provided code to strip the desired font:

    var fontCleaner = /(\<span style=\"[a-z\-\:\s0-9\;]*)(font-family\s*\:\s*SetTheFONTHere)/ig;

    Greetings,
    Rumen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center

  3. Clive Atkins
    Clive Atkins avatar
    14 posts
    Member since:
    Jul 2007

    Posted 25 Oct 2007 Link to this post


    Thanks for your solution as it does identify the issue to hand.
    My next question is would it be possible to add the above solution into the Telerik itself rather than each page within SharePoint? (I hope I read your comments correctly)

    The reason I ask, is the site has gone live and the least amount of impact would be to incorporate the solution code into the deployed Telerik RadEditor instead. Is this possible? If so, could you please state which which part would require to be updated and how?

    Thanks.

    Regards,
    Keith.
  4. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 25 Oct 2007 Link to this post

    Hi Keith,

    I have good news that this code is built-into the latest version of RadEditor 7.2.1. Could you please download the latest version, test it and see whether the problem still persists on your side? The version of RadEditor for MOSS is 4.4.1 (RadEditor_MOSS_4_4_1_dev.zip).

    You can also try to reproduce the problem online here: http://www.telerik.com/demos/aspnet/Editor/Examples/Default/DefaultCS.aspx

    Kind regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Clive Atkins
    Clive Atkins avatar
    14 posts
    Member since:
    Jul 2007

    Posted 22 Nov 2007 Link to this post

    Hi Rumen,
    The new version fixed the issue which is great. Thanks.

    One more question: Is there a way to control what gets formatted\stripped on a copy and paste from word?

    Thanks.
    Keith.
  6. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 22 Nov 2007 Link to this post

    Hi Keith,

    I am glad that the new version works properly on your side.

    Yes, you can control the paste behavior by setting the StripFormattingOnPaste enum property to the one of more of following values:
    • None - pastes the clipboard content as is
    • MSWord - strips Word-specific tags on Paste, preserving fonts and text sizes
    • MSWordNoFonts - strips Word-specific tags on Paste, preserving text sizes only
    • MSWordRemoveAll - strips Word-specific tag on Paste, removing both fonts and text sizes
    • Css - strips CSS styles on Paste
    • Font - strips Font tags on Paste
    • Span - strips Span tags on Paste
    • All - strips all HTML formatting and pastes plain text
    • NoneSupressCleanMessage - Doesn't strip anything on paste and does not ask questions.

    Best regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  7. Clive Atkins
    Clive Atkins avatar
    14 posts
    Member since:
    Jul 2007

    Posted 23 Nov 2007 Link to this post

    Hi Rumen,

    Just to clarify - I followed the migration to convert richtexthtml controls to
    RadHtmlField as described within the help.chm that came with the RadEditor.

    Within the aspx page I have the following code:

    <radE:RadHtmlField ID="RadHtmlField1" FieldName="MainContent" runat="server"></radE:RadHtmlField>

    if I add the property of StripFormattingOnPaste="All" to get <radE:RadHtmlField ID="RadHtmlField1" FieldName="MainContent" runat="server" StripFormattingOnPaste="All"></radE:RadHtmlField>

    I then get the following error: Type 'Telerik.SharePoint.FieldEditor.RadHtmlField' does not have a public property named 'StripFormattingOnPaste'.

    Within the aspx page I have the following reference to the control:
    <%@ Register TagPrefix="radE" Namespace="Telerik.SharePoint.FieldEditor" Assembly="RadEditorSharePoint, Version=4.1.0.0, Culture=neutral, PublicKeyToken=1f131a624888eeed" %>

    I take it there is another approach?
    Just out of curiosity, can you specify the global behaviour of 'copying and pasting from word' within the config files in folder "C:\Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\4.4.1.0__1f131a624888eeed\RadControls\Editor"?

    Cheers.
    Keith.
  8. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 23 Nov 2007 Link to this post

    Hi Keith,

    Yes, exactly the only possible way to set the StripFormattingOnPaste property is in the editor's ConfigFile.xml file placed in the C:\Program Files\Common Files\Microsoft Shared\web server extensions\wpresources\RadEditorSharePoint\4.4.1.0__1f131a624888eeed\RadControls\Editor folder. If you use RadEditor in list (Wiki) scenario then you should set this property in the ListConfigFile.xml in the same folder.

    <property name="StripFormattingOnPaste">All</property>

    You can find more information about the ConfigFile property in the following help article: Setting ConfigFile and ToolsFile properties for the WCM field and Set Properties Via Config File.

    Best regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  9. Clive Atkins
    Clive Atkins avatar
    14 posts
    Member since:
    Jul 2007

    Posted 05 Dec 2007 Link to this post

    Hi Rumen,

    Thanks for the feedback. It worked a treat! :-)

    Regards,
    Keith.
  10. Michael
    Michael avatar
    1 posts
    Member since:
    Mar 2008

    Posted 22 Apr 2008 Link to this post

    I tried the link that was provided and it does not fix the symbol (Greek) pasting from MS Word. I copied and pasted a word document in the editor and it popped up a Dialog box asking if I wanted to clean the text. When I click ok it turned the text to Greek. I tried the url on another computer just to see what would happen and this time when I pasted from MS Word the Dialog box DID NOT popup and it pasted just fine.

    I believe the problem is with the code behind the "yes" button on that Dialog box that's messing up the paste.

    thanks
    dmcnease
  11. Rumen
    Admin
    Rumen avatar
    12846 posts

    Posted 23 Apr 2008 Link to this post

    Hi Doug,

    Could you please review the following help article which could be helpful for your scenario:
    Appearance of Greek symbols on pasting from Word?

    If it does not help you to fix the problem, please open a support ticket, specify the editor version used in your project, provide sample Word document with problematic content and steps to reproduce the problem. Once we are to reproduce the issue, we will do our best to help.

    Please, also try to reproduce the problem with the latest version of RadEditor in the following example: Default Example.

    Best regards,
    Rumen
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top