Ticket #6465 (confirmed Bug)

Opened 4 years ago

Last modified 4 months ago

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:

  1. Open one of samples provided and paste it into editor using CRTL+V button, paste button and paste from word button

Results:

  1. 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.
  2. Opera, Chrome and FF - In all cases there is no background
  3. Safari - table is pasted as paragraph (doesn't matter which command you use). I have described this as separate issue #8639)
    <p>
    	&nbsp; &nbsp; &nbsp;a b c d &nbsp;</p>
    

Issue(s) has been reproducible from CKEditor 3.0.

Attachments

input.xls (14.5 KB) - added by paho 4 years ago.
ie8_6465.png (17.9 KB) - added by wwalc 3 years ago.
8594.xls (13.5 KB) - added by j.swiderski 3 years ago.
8594.xlsx (9.5 KB) - added by j.swiderski 3 years ago.

Change History

Changed 4 years ago by paho

comment:1 Changed 4 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:2 Changed 4 years ago by paho

  • Status changed from new to confirmed

comment:3 follow-up: ↓ 4 Changed 4 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 3 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 3 years ago by garry.yao

  • Status changed from confirmed to pending

WFM in IE, more clue?

comment:6 Changed 3 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 3 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).

Changed 3 years ago by wwalc

comment:8 Changed 3 years 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 3 years 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:

  1. Open one of samples provided and paste it into editor using CRTL+V button, paste button and paste from word button

Results:

  1. 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.
  2. Opera, Chrome and FF - In all cases there is no background
  3. Safari - table is pasted as paragraph (doesn't matter which command you use). I have described this as separate issue #8639)
    <p>
    	&nbsp; &nbsp; &nbsp;a b c d &nbsp;</p>
    

Issue(s) has been reproducible from CKEditor 3.0.

Note:

  1. When pasting first to word and then to Excel everything seems to be fine but this should work without Word.
Last edited 2 years ago by j.swiderski (previous) (diff)

Changed 3 years ago by j.swiderski

Changed 3 years ago by j.swiderski

comment:10 Changed 2 years 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:11 Changed 2 years ago by j.swiderski

  • Description modified (diff)

comment:12 Changed 2 years ago by j.swiderski

#9114 was marked as duplicate.

comment:13 Changed 2 years 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 22 months ago by j.swiderski

#9435 was marked as duplicate.

comment:15 Changed 21 months ago by j.swiderski

  • Description modified (diff)

comment:16 Changed 17 months ago by j.swiderski

#10200 was marked as duplicate.

comment:17 Changed 15 months ago by j.swiderski

#10443 was marked as duplicate.

comment:18 Changed 10 months ago by j.swiderski

This issue was reported on our support channel by Oracle.

comment:19 Changed 4 months ago by j.swiderski

I have checked this issue one more time on Mac and Windows.

The problem is that CKEditor doesn't have much to do here. It is the browsers that don’t see/receive any styles from Excel. Browser sees no background, no font color and no bold.

There were 2 exceptions however:

  1. IE - original TC seems to be confirmed for IE8-11. When you paste table with CRRL+V styles are present but when you do the same with pasteFromWord they are removed so IE works partially.
  2. FF on Mac with allowedContent:true - you could actually see background color but this was because together with table, style tag (which contained this style for td) was pasted.

After checking this I think this is a 'won't fix' issue.

Last edited 4 months ago by j.swiderski (previous) (diff)

comment:20 Changed 4 months ago by fredck

We may keep this ticket opened for future reference, especially considering that at least on IE there is a bit more information available so we may try to use it.

comment:21 Changed 4 months ago by j.swiderski

especially considering that at least on IE there is a bit more information available so we may try to use it.

Yes, exactly. IE is the only browser that sees some information so we may try to make it support Excel fully.

Note: See TracTickets for help on using tickets.
© 2003 – 2012 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy