Opened 7 years ago

Closed 2 years ago

Last modified 15 months ago

#6465 closed Bug (wontfix)

Paste: content pasted from Excel document loses formatting

Reported by: Paweł Horzela Owned by:
Priority: Normal Milestone:
Component: Core : Pasting Version: 3.0
Keywords: CantFix Cc: kenny.demetter@…

Description (last modified by Jakub Ś)

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 (4)

input.xls (14.5 KB) - added by Paweł Horzela 7 years ago.
ie8_6465.png (17.9 KB) - added by Wiktor Walc 6 years ago.
8594.xls (13.5 KB) - added by Jakub Ś 6 years ago.
8594.xlsx (9.5 KB) - added by Jakub Ś 6 years ago.

Download all attachments as: .zip

Change History (28)

Changed 7 years ago by Paweł Horzela

Attachment: input.xls added

comment:1 Changed 7 years ago by Paweł Horzela

Description: modified (diff)
Summary: ckeditor paste from word detection difference ctrl v and button excelPaste: text pasted from word is cleaned up even when you select 'Cancel' on prompt window

comment:2 Changed 7 years ago by Paweł Horzela

Status: newconfirmed

comment:3 Changed 7 years ago by Paweł Horzela

Using 'Ctrl+V' works only for IE8. For other browsers it doesn't work as well.

comment:4 in reply to:  3 Changed 6 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 6 years ago by Garry Yao

Status: confirmedpending

WFM in IE, more clue?

comment:6 Changed 6 years ago by Wiktor Walc

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 6 years ago by Wiktor Walc

Keywords: IE added
Status: pendingconfirmed
Summary: Paste: text pasted from word is cleaned up even when you select 'Cancel' on prompt windowPaste: 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 6 years ago by Wiktor Walc

Attachment: ie8_6465.png added

comment:8 Changed 6 years ago by Jakub Ś

Keywords: IE removed
Summary: Paste: content pasted in IE from Excel document loses formattingPaste: content pasted from Excel document loses formatting

#8594 was marked as duplicate

comment:9 Changed 6 years ago by Jakub Ś

Version: 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 5 years ago by Jakub Ś (previous) (diff)

Changed 6 years ago by Jakub Ś

Attachment: 8594.xls added

Changed 6 years ago by Jakub Ś

Attachment: 8594.xlsx added

comment:10 Changed 5 years ago by Frederico Caldeira Knabben

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 5 years ago by Jakub Ś

Description: modified (diff)

comment:12 Changed 5 years ago by Jakub Ś

#9114 was marked as duplicate.

comment:13 Changed 5 years ago by Jakub Ś

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 5 years ago by Jakub Ś

#9435 was marked as duplicate.

comment:15 Changed 5 years ago by Jakub Ś

Description: modified (diff)

comment:16 Changed 4 years ago by Jakub Ś

#10200 was marked as duplicate.

comment:17 Changed 4 years ago by Jakub Ś

#10443 was marked as duplicate.

comment:18 Changed 4 years ago by Jakub Ś

This issue was reported on our support channel by Oracle.

comment:19 Changed 3 years ago by Jakub Ś

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 3 years ago by Jakub Ś (previous) (diff)

comment:20 Changed 3 years ago by Frederico Caldeira Knabben

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 3 years ago by Jakub Ś

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.

comment:22 Changed 2 years ago by Jakub Ś

Keywords: Can't Fix added
Resolution: wontfix
Status: confirmedclosed

Ok, this is quite an old issue but it is time to update and close it.

IE8-11 and CKEditor 4.x work very nice with Excel. This is because IE has all the information about styles used.

Blink and Firefox only receive Raw HTML without any styling (well there is width but no info about color and border is set to none). Until Browser Vendors read that data, wan't cannot do anything to fix this.

comment:23 Changed 2 years ago by Frederico Caldeira Knabben

Keywords: CantFix added; Can't Fix removed

comment:24 Changed 15 months ago by Jakub Ś

There is variation of pasting into Excel in IE: #14581

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