Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#11950 closed Bug (invalid)

Paste from Word fails with table from Excel

Reported by: Alasdair Ross Owned by:
Priority: Normal Milestone:
Component: Plugin : Paste from Word Version:
Keywords: Cc:

Description

Pasting a table either directly from Excel, or via Word results in lost formatting.

Attached is an example table in Excel (2013) (Table Test.xlsx). If I copy this, you can see the html stored in the clipboard in the "Excel Clipboard Contents.txt" (found using Notepad++).

If I paste directly from Excel into the Demo (http://ckeditor.com/demo#full) I see a table with no formatting at all. See "Paste from Excel.png" and "Paste from Excel Source.txt" for the output provided by the "Source" link in the demo.

If I paste directly from Excel using the "Paste from Word" plugin, no formatting is carried into the popup. See "Paste From Excel PFW PopUp.png". The output is identical to pasting directly from Excel (without using the PFW button/plugin).

If I copy the table from Excel, paste it into Word, then copy the table from Word (see "Test Table.docx") I get the following behaviour. See "Word Clipboard Contents.txt" for what was on the clipboard:

Pasting from Word directly into the editor gives a table that has retained the 'bold' headings from the table, but no other styles. See "Paste From Word Source.txt" and "Paste From Word.png".

Pasting from Word into the PFW plugin gives the correct table in the PFW plugin pop-up (see "Paste From Word PFW PopUp") but the same result as if the table was pasted not using the plugin.

I've seen the same results locally. These tests were run with Office 2013, Windows 8.1 and Firefox 29.0.1.

Attachments (10)

Excel Clipboard Contents.txt (4.1 KB) - added by Alasdair Ross 10 years ago.
Clipboard contents after copying table from Excel
Paste From Excel PFW PopUp.png (31.2 KB) - added by Alasdair Ross 10 years ago.
Paste From Excel PFW PopUp
Paste From Excel Source.txt (756 bytes) - added by Alasdair Ross 10 years ago.
Paste From Excel Source
Paste from Excel.png (28.5 KB) - added by Alasdair Ross 10 years ago.
Paste from Excel
Paste From Word PFW PopUp.png (33.1 KB) - added by Alasdair Ross 10 years ago.
Paste From Word PFW PopUp
Paste From Word Source.txt (1.5 KB) - added by Alasdair Ross 10 years ago.
Paste From Word Source
Word Clipboard Contents.txt (48.8 KB) - added by Alasdair Ross 10 years ago.
Word Clipboard Contents
Test Table.xlsx (8.2 KB) - added by Alasdair Ross 10 years ago.
Excel Test Table
Test Table.docx (11.7 KB) - added by Alasdair Ross 10 years ago.
Word Test Table
Paste From Word.png (30.5 KB) - added by Alasdair Ross 10 years ago.
Paste From Word

Download all attachments as: .zip

Change History (14)

Changed 10 years ago by Alasdair Ross

Clipboard contents after copying table from Excel

Changed 10 years ago by Alasdair Ross

Paste From Excel PFW PopUp

Changed 10 years ago by Alasdair Ross

Attachment: Paste From Excel Source.txt added

Paste From Excel Source

Changed 10 years ago by Alasdair Ross

Attachment: Paste from Excel.png added

Paste from Excel

Changed 10 years ago by Alasdair Ross

Paste From Word PFW PopUp

Changed 10 years ago by Alasdair Ross

Attachment: Paste From Word Source.txt added

Paste From Word Source

Changed 10 years ago by Alasdair Ross

Attachment: Word Clipboard Contents.txt added

Word Clipboard Contents

Changed 10 years ago by Alasdair Ross

Attachment: Test Table.xlsx added

Excel Test Table

Changed 10 years ago by Alasdair Ross

Attachment: Test Table.docx added

Word Test Table

Changed 10 years ago by Alasdair Ross

Attachment: Paste From Word.png added

Paste From Word

comment:1 Changed 10 years ago by Alasdair Ross

Component: GeneralPlugin : Paste from Word
Version: 4.4.0

comment:2 Changed 10 years ago by Jakub Ś

Resolution: invalid
Status: newclosed
Version: 4.4.0
  1. Pasting with Crtl+V and with PFW dialof always activates PFW is content is recognized to come from MS Word.
  1. CKEditor has two options that enable style pasted from word. Please see http://docs.ckeditor.com/#!/api/CKEDITOR.config. Your table will work with below 3 options turned on/off. NOTE: we recommend turning off ACF only when your CKEditor is meant to allow users to enter all HTML tags.
    var editor = CKEDITOR.replace( 'editor1', {				
    	allowedContent : true,
    	pasteFromWordRemoveFontStyles : false,
    	pasteFromWordRemoveStyles : false
    });
    
  2. We don't support pasting from Excel currently. It works in most cases but there are issues:
    http://dev.ckeditor.com/ticket/8639
    http://dev.ckeditor.com/ticket/6465

comment:3 Changed 10 years ago by Alasdair Ross

  1. OK
  1. I'd downloaded the 'full' version and using the simple example page, tried the pasteFromWord settings in the config.js and they had no effect (perhaps that's a separate bug).

Putting the settings in the html file did make them take effect and the Word formatting is retained now.

  1. Are there plans to add support for pasting from Excel?

I wouldn't say it works 'in most cases'. I've found very little formatting gets carried across.

I know excel puts all its styles in the header of the html doc that's on the clipboard (see attached example) so they're not inline in the fragment of html to be pasted. Do you know if the browser has access to this clipboard information so the plugin could be modified to convert the styles to be inline with the fragment to be pasted?

comment:4 Changed 10 years ago by Jakub Ś

  1. It works correctly. Either you have used invalid synatx or you haven't refreshed cache.
  1. "Are there plans to add support for pasting from Excel?"
    Yes, but in the future.
    About styles visible in browser - I see that only IE manages it (converts to inline styles) but all other browsers don't see styles just plain HTML.
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy