Paste from work changes the headers to paragraph

6 posts, 0 answers
  1. Ladan
    Ladan avatar
    3 posts
    Member since:
    Sep 2012

    Posted 06 Sep 2012 Link to this post

    Paste from word in rich text editor is adding p tags to the headers and therefore the proper style is not appearing in front end, or someone has to edit styles on the headers after pasting to Roch text editor. Any idea how I can fix this?
  2. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 10 Sep 2012 Link to this post

    Hello,

    RadEditor just strips the MS Word specific tags, styles and attributes. It does not strip the valid HTML and XHTML tags and attributes.

    That is why my suggestion is to paste the MS Word content in RadEditor or in an editable iframe/div and see how it is pasted with the MS Word formatting and whether the p tags exist in the headers.

    All the best,
    Rumen
    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.
  3. Ladan
    Ladan avatar
    3 posts
    Member since:
    Sep 2012

    Posted 10 Sep 2012 Link to this post

    Thank you for replying to my message. Here is what I see when I paste the content from word



    As you can see there is no P tag in the content but if I paste to the Rich text editor in sitecore it adds the P tags to the headlines
  4. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 11 Sep 2012 Link to this post

    Hi,

    You should paste the Word content directly in the red bordered iframe content area and to preview it press the Show Iframe HTML button.

    The first textbox is to set HTML/plain text content in the iframe and is not related to the paste scenario.

    Kind regards,
    Rumen
    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.
  5. Ladan
    Ladan avatar
    3 posts
    Member since:
    Sep 2012

    Posted 14 Sep 2012 Link to this post

    I can see that the P tags are inserted when I paste from word.



    any suggestion how I can get rid of the p tags? there are suppose to be H2 tags ....
  6. Rumen
    Admin
    Rumen avatar
    14324 posts

    Posted 19 Sep 2012 Link to this post

    Hello,

    You can attach to the OnClientPasteHtml event of RadEditor, which will give you access to the pasted content before it is inserted in the content area. In this event you can check for the executed command (args.get_commandName()) and modify the content provided by the args.get_value() method. After that set the modified content in the editor via the args.set_value() method.

    Greetings,
    Rumen
    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