Opened 14 years ago

Closed 13 years ago

#6270 closed Bug (fixed)

Chrome: Difficulties pasting tables from Excel

Reported by: Jude Allred Owned by:
Priority: Normal Milestone:
Component: Core : Pasting Version: 3.4
Keywords: Webkit Opera Cc:

Description

  1. open an Excel 2007 spreadsheet
  1. select some cells and hit ctrl+c
  1. using chrome, go to http://ckeditor.com/demo
  1. Paste the table into the editor using ctrl+v
  1. right click on the newly-pasted table
  1. [bug 1] the 'Table Properties' menu item is missing from the context menu.
  1. view the source. [bug 2] Notice that the newly inserted table has each <tr> wrapped in a <p>, and there is no containing <table> tag.
  1. [bug 3] return to wysiwyg mode- the table no longer looks like a table.

This is caused by Chrome failing to wrap the pasted HTML in a <table> tag. One workaround (which I'm currently using) is to use a special paste handler for Webkit:

if (CKEDITOR.env.webkit) {
	editor.ck.on('paste', function(evt) {
		if (evt.data.html) {
			//If this html contains table elements
			if ($('tr:first, td:first, th:first', evt.data.html).length) {
				//...but does not contain any <table> tags
				if ($('table:first', evt.data.html).length === 0) {
					//Wrap it in a table.
					evt.data.html = $('<table>').
						addClass(editor.ck.config.tableClass).
						append(evt.data.html)[0].
						outerHTML;
				}
			}
		}
	});
}

Change History (3)

comment:1 Changed 14 years ago by Jude Allred

note that in the above example, my editor instance is "editor.ck", not to be confused with CKEditor's internal 'editor' reference.

comment:2 Changed 14 years ago by Krzysztof Studnik

Component: GeneralCore : Pasting
Keywords: Webkit Opera added
Status: newconfirmed
Version: 3.4

Confirmed on Chrome 6;7; Opera 10.61; Safari with CKE 3.4.1 nightly and demo
Table formating is lost so "bug1" in point 6 is consequence of problems in point 7&8

comment:3 Changed 13 years ago by Jakub Ś

Resolution: fixed
Status: confirmedclosed

Seems that this issue has expired on trunk.

It is no longer reproducible in Chrome 16 and Opera 11.60

Problems with lost formatting has been described here #6465

Problem with Safari which currently can’t handle parsing tables pasted from Excel was described here #8639

Closing this one as fixed.

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