Ticket #6465 (confirmed Bug)
Paste: content pasted from Excel document loses formatting
| Reported by: | paho | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | Core : Pasting | Version: | 3.0 |
| Keywords: | Cc: | kenny.demetter@… |
Description (last modified by j.swiderski) (diff)
NEW CORRECT TC:
It seems that we have problems with formatting content pasted from Excel.
To reproduce:
- Open one of samples provided and paste it into editor using CRTL+V button, paste button and paste from word button
Results:
- IE6-9 - Background is not preserved when using paste from word button although it is present in HTML. CRTL+V button and paste button work on the other hand.
- Opera, Chrome and FF - In all cases there is no background
- Safari - table is pasted as paragraph (doesn't matter which command you use). I have described this as separate issue #8639)
<p> a b c d </p>
Issue(s) has been reproducible from CKEditor 3.0.
Attachments
Change History
comment:1 Changed 3 years ago by paho
- Description modified (diff)
- Summary changed from ckeditor paste from word detection difference ctrl v and button excel to Paste: text pasted from word is cleaned up even when you select 'Cancel' on prompt window
comment:3 follow-up: ↓ 4 Changed 3 years ago by paho
Using 'Ctrl+V' works only for IE8. For other browsers it doesn't work as well.
comment:4 in reply to: ↑ 3 Changed 2 years ago by garry.yao
Replying to paho:
Using 'Ctrl+V' works only for IE8. For other browsers it doesn't work as well.
When there's no prompt triggered for content from MS Excel in other browsers, it's because there's no cleanup needed.
comment:5 Changed 2 years ago by garry.yao
- Status changed from confirmed to pending
WFM in IE, more clue?
comment:6 Changed 2 years ago by wwalc
WFM as well, I have used a custom cleanup function from #7304 to make sure it is not executed when 'Cancel' is pressed.
comment:7 Changed 2 years ago by wwalc
- Keywords IE added
- Status changed from pending to confirmed
- Summary changed from Paste: text pasted from word is cleaned up even when you select 'Cancel' on prompt window to Paste: content pasted in IE from Excel document loses formatting
The original TC is wrong. This issue has nothing to do with the pastefromword plugin. To prove it, I managed to reproduce it with:
config.removePlugins='pastefromword';
The only thing you need to reproduce it, is to set in IE8: "Tools -> Internet Options -> Security -> Custom Level -> Scripting -> Allow programmatic clipboard access" to Enable.
Remember to run it in IE7 mode. I have confirmed this issue also in IE6.
Having IE configured in the right way, copy contents from input.xls and paste it with the "Paste" button. Note that the formatting is lost, all colors are gone (see the screenshot).
comment:8 Changed 17 months ago by j.swiderski
- Keywords IE removed
- Summary changed from Paste: content pasted in IE from Excel document loses formatting to Paste: content pasted from Excel document loses formatting
#8594 was marked as duplicate
comment:9 Changed 17 months ago by j.swiderski
- Version set to 3.0
Below is the comment from #8594 - the issue concerns all browsers
It seems that we have problems with formatting content pasted from Excel.
To reproduce:
- Open one of samples provided and paste it into editor using CRTL+V button, paste button and paste from word button
Results:
- IE6-9 - Background is not preserved when using paste from word button although it is present in HTML. CRTL+V button and paste button work on the other hand.
- Opera, Chrome and FF - In all cases there is no background
- Safari - table is pasted as paragraph (doesn't matter which command you use). I have described this as separate issue #8639)
<p> a b c d </p>
Issue(s) has been reproducible from CKEditor 3.0.
Note:
- When pasting first to word and then to Excel everything seems to be fine but this should work without Word.
comment:10 Changed 14 months ago by fredck
I've created an Excel document with a single cell filled with the number "1". I've then made it bold, with red font and yellow background.
By checking the raw data the browser receives from Excel on pasting, without passing it through the editor, I found that we'll hardly be able to do something here.
The following is what I had with Firefox:
<table width="64" border="0" cellpadding="0" cellspacing="0"><colgroup><col width="64"></colgroup><tbody><tr height="19"> <td class="xl65" style="height:14.4pt; width:48pt" align="right" height="19" width="64">1</td> </tr></tbody></table>
This is IE instead:
<TABLE style="WIDTH: 48pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=64> <COLGROUP> <COL style="WIDTH: 48pt" width=64> <TBODY> <TR style="HEIGHT: 14.4pt" height=19> <TD style="BORDER-BOTTOM: #f0f0f0; BORDER-LEFT: #f0f0f0; BACKGROUND-COLOR: yellow; WIDTH: 48pt; HEIGHT: 14.4pt; BORDER-TOP: #f0f0f0; BORDER-RIGHT: #f0f0f0" class=xl65 height=19 width=64 align=right><STRONG><FONT color=#ff0000 face=Calibri>1</FONT></STRONG></TD></TR></TBODY></TABLE>
So we can see that the formatting information is simply not passed to FF. Additionally, despite the additional information available with IE, we have no ways to "sniff" this data to understand that it comes from Excel. So, there is no chance for us to work on it to make it better. At the current stage, at least.
comment:12 Changed 10 months ago by j.swiderski
#9114 was marked as duplicate.
comment:13 Changed 10 months ago by j.swiderski
User @linnex in #9114 has suggested a fix.
Hi,
I tried to explain it above, maybe I wasn't exact enough though.
I just added one line to the following code snippet in "pastefromword\filter\default.js"
// Otherwise provide a black-list of styles that we remove.
[
[ ( /^mso-/ ) ],
// Fixing color values.
[ ( /-color$/ ), null, function( value )
{
if ( value == 'transparent' )
return false;
if ( CKEDITOR.env.gecko )
return value.replace( /-moz-use-text-color/g, 'transparent' );
// 2012-07-25 linnex: the following line is new
return value;
} ],
I believe the problem is the blacklist that falsely removes all back-colors from Excel pastes instead of transparent only.
It worked for me.
Cheers linnex
comment:14 Changed 7 months ago by j.swiderski
#9435 was marked as duplicate.
comment:16 Changed 2 months ago by j.swiderski
#10200 was marked as duplicate.
comment:17 Changed 7 days ago by j.swiderski
#10443 was marked as duplicate.
