Opened 15 years ago

Closed 15 years ago

#4665 closed Bug (fixed)

[IE] Behavior for pasting from Excel is changed in 'pasting' branch

Reported by: pomu0325 Owned by: Garry Yao
Priority: Normal Milestone: CKEditor 3.1
Component: Core : Pasting Version: SVN (CKEditor) - OLD
Keywords: Confirmed Review? Cc: pomu@…

Description

I tried the new pasting feature listed in #4379, and I found that the behavior is changed when I copy & paste from Excel.

Before, the borders of Excel cell was reflected in the CKEditor, but in the pasting branch, borders are no more copied.

Attachments (2)

paste_test.html (545 bytes) - added by pomu0325 15 years ago.
test code for comparing execCommand('paste')
4665_testdata.xls (13.5 KB) - added by pomu0325 15 years ago.
test excel file

Download all attachments as: .zip

Change History (11)

Changed 15 years ago by pomu0325

Attachment: paste_test.html added

test code for comparing execCommand('paste')

comment:1 Changed 15 years ago by pomu0325

Summary: Behavior for pasting from Excel is changed in 'pasting' branch[IE] Behavior for pasting from Excel is changed in 'pasting' branch

TextRange.execCommand('paste') is used in new pasting feature, but it generates different html codes than document.execCommand('paste') which was used in current CKEditor release.

Try attached code with IE, copy a bordered cell from Excel and click 'paste' button.

  • document.execCommand('paste') generates following table
    <TABLE style="WIDTH: 48pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=64 x:str>
    <COLGROUP>
    <COL style="WIDTH: 48pt" width=64>
    <TBODY>
    <TR style="HEIGHT: 12.75pt" height=17>
    <TD style="BORDER-BOTTOM: windowtext 0.5pt solid; BORDER-LEFT: windowtext 0.5pt solid; 
    BACKGROUND-COLOR: transparent; WIDTH: 48pt; HEIGHT: 12.75pt; BORDER-TOP: windowtext 0.5pt solid;
     BORDER-RIGHT: windowtext 0.5pt solid" class=xl24 height=17 width=64><FONT 
    size=2>test</FONT></TD></TR></TBODY></TABLE>
    
  • TextRange.execCommand('paste') generates following, border-* and background-color style is disappeared
    <TABLE style="WIDTH: 48pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=64 x:str>
    <COLGROUP>
    <COL style="WIDTH: 48pt" width=64>
    <TBODY>
    <TR style="HEIGHT: 12.75pt" height=17>
    <TD style="WIDTH: 48pt; HEIGHT: 12.75pt" class=xl24 height=17 width=64>test</TD></TR></TBODY></TABLE>
    

comment:2 Changed 15 years ago by Garry Yao

Keywords: Confirmed added
Milestone: CKEditor 3.1
Owner: set to Garry Yao
Status: newassigned

@pomu0325 Thanks for the discovery, that's very important for us, I have even noticed the difference when coding in the paste branch and the missing style is far not limited to 'border-', we may sometimes missing 'margin-' as I experienced before.

comment:3 Changed 15 years ago by Garry Yao

Found another approach which could avoid using the weird TextRange.execCommand('paste').
Changes are committed with [4482] at paste branch.

comment:4 Changed 15 years ago by Garry Yao

Keywords: Review? added

@pomu0325 I believe I've fixed the excel pasting issue as well, but would ask you to attach the sample excel file for confirmation.

Changed 15 years ago by pomu0325

Attachment: 4665_testdata.xls added

test excel file

comment:5 Changed 15 years ago by pomu0325

It outputs almost the same result as 3.0.1, besides <p>&nbsp;</p> is inserted at the very beginning.

<p>
	&nbsp;</p>
<table border="0" cellpadding="0" cellspacing="0" style="width: 48pt; border-collapse: collapse" 
width="64" x:str="">
	<tbody>
		<tr height="17" style="height: 12.75pt">
			<td class="xl24" height="17" style="border-bottom: windowtext 0.5pt 
solid; border-left: windowtext 0.5pt solid; background-color: transparent; width: 48pt; height: 
12.75pt; border-top: windowtext 0.5pt solid; border-right: windowtext 0.5pt solid" width="64">

				test</td>
		</tr>
	</tbody>
	<colgroup>
		<col style="width: 48pt" width="64" />
	</colgroup>
</table>

to reproduce

  • Copy the 1st cell from attached Excel file by Ctrl+C
  • Select all the contents in the WYSIWYG area by Ctrl+A
  • Paste by Ctrl+V
  • Switch to source mode

comment:6 Changed 15 years ago by Frederico Caldeira Knabben

Keywords: Review- added; Review? removed

comment:7 Changed 15 years ago by Garry Yao

Keywords: Review? added; Review- removed

It outputs almost the same result as 3.0.1, besides <p>&nbsp;</p> is inserted at the very beginning.

The problem described at this ticket was the inline style lost issue, instead of anything else, which would desire other tickets. The empty paragraph issue mentioned here is supposed to be fixed at #3105.

comment:8 in reply to:  7 Changed 15 years ago by pomu0325

Replying to garry.yao:

The problem described at this ticket was the inline style lost issue, instead of anything else, which would desire other tickets.

I see your point. As far as Excel pasting issue, fix confirmed.

comment:9 Changed 15 years ago by Frederico Caldeira Knabben

Resolution: fixed
Status: assignedclosed

Ok... we'll be handling it at the pasting branch at this point.

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