Open Bug 1640726 Opened 4 years ago Updated 2 years ago

The user is unable to copy a table from Microsoft Excel to Microsoft Word Online

Categories

(Core :: DOM: Editor, defect, P2)

Desktop
Windows 10
defect

Tracking

()

Webcompat Priority P3
Tracking Status
firefox76 --- affected
firefox77 --- affected
firefox78 --- affected
firefox91 --- affected

People

(Reporter: rdoghi, Unassigned)

References

(Blocks 2 open bugs, )

Details

(Keywords: parity-chrome)

Attachments

(2 files)

Attached video 2020-05-25_21h53_59.mp4

[Affected versions]:
Nightly 78.0a1 (2020-05-25)

[Affected platforms]:
Platforms: Windows 10

Steps :

  1. Create a simple Table with content in Microsoft Excel
  2. Launch the Firefox browser and reach a Word Document From Office 365.
  3. Try to Copy/Paste 2 rows from the Excel app into the online editor.

Expected Results :
The 2 rows should copy without issues with the correct table format.

Actual Results :
The table rows are copied as text in a single line.

Note: Please note that this issue does not occur in Google Chrome

Severity: -- → S3
Blocks: 1636028

Copy pasting from Libre Office Calc to Google Docs works.

Webcompat Priority: --- → ?
Priority: -- → P2

Reproduced this with current Nightly on Windows.

The clipboard's HTML format looks as follows:

Version:1.0
StartHTML:0000000105
EndHTML:0000002011
StartFragment:0000001592
EndFragment:0000001959

<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 15">
<link id=Main-File rel=Main-File
href="file:///C:/Users/MIRKOB~1/AppData/Local/Temp/msohtmlclip1/01/clip.htm">
<link rel=File-List
href="file:///C:/Users/MIRKOB~1/AppData/Local/Temp/msohtmlclip1/01/clip_filelist.xml">
<style>
<!--table
	{mso-displayed-decimal-separator:"\,";
	mso-displayed-thousand-separator:"\.";}
@page
	{margin:.75in .7in .75in .7in;
	mso-header-margin:.3in;
	mso-footer-margin:.3in;}
tr
	{mso-height-source:auto;}
col
	{mso-width-source:auto;}
br
	{mso-data-placement:same-cell;}
td
	{padding-top:1px;
	padding-right:1px;
	padding-left:1px;
	mso-ignore:padding;
	color:black;
	font-size:11.0pt;
	font-weight:400;
	font-style:normal;
	text-decoration:none;
	font-family:Calibri, sans-serif;
	mso-font-charset:0;
	mso-number-format:General;
	text-align:general;
	vertical-align:bottom;
	border:none;
	mso-background-source:auto;
	mso-pattern:auto;
	mso-protection:locked visible;
	white-space:nowrap;
	mso-rotate:0;}
-->
</style>
</head>

<body link="#0563C1" vlink="#954F72">

<table border=0 cellpadding=0 cellspacing=0 width=204 style='border-collapse:
 collapse;width:153pt'>
<!--StartFragment-->
 <col width=68 span=3 style='width:51pt'>
 <tr height=19 style='height:14.25pt'>
  <td height=19 width=68 style='height:14.25pt;width:51pt'>X</td>
  <td width=68 style='width:51pt'>Y</td>
  <td width=68 style='width:51pt'>X</td>
 </tr>
 <tr height=19 style='height:14.25pt'>
  <td height=19 style='height:14.25pt'>A</td>
  <td>B</td>
  <td>C</td>
 </tr>
<!--EndFragment-->
</table>

</body>

</html>

and indeed, Chrome consumes this correctly. Pasting to Google Docs works with Firefox.

Component: DOM: Selection → DOM: Editor
Summary: The user is unable to copy a table from Microsoft EXCEL to Online Word Editors → The user is unable to copy a table from Microsoft Excel to Microsoft's online Word

Interestingly, pasting a table from some website (which uses Gecko's mechanism to fill the clipboard) to Microsoft Word Online works. The clipboard content looks as follows:

Version:0.9
StartHTML:00000155
EndHTML:00000548
StartFragment:00000189
EndFragment:00000512
SourceURL:https://www.w3schools.com/html/html_tables.asp
<html><body>
<!--StartFragment--><table id="customers"><tbody><tr><th>Company</th>
    <th>Contact</th>
    <th>Country</th>
  </tr>
  <tr>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Germany</td>
  </tr>
  <tr>
    <td>Centro comercial Moctezuma</td>
    <td>Francisco Chang</td>
    <td>Mexico</td></tr></tbody></table><!--EndFragment-->
</body>
</html> 

Compared to c2, the fragment additionally contains the <table> markup.

Pasting a table copied from Microsoft Word (offline) works. There, the <table> is part of the fragment too.

Pasting a table from Excel (offline) to Excel Online works too.

I think that when <!--StartFragment--> wraps a part of a <table>, and pasting it into non-table element, necessary table structure element such as <table> and/or <tr> elements should be added by our editor.

(In reply to Masayuki Nakano [:masayuki] (he/him)(JST, +0900) from comment #4)

I think that when <!--StartFragment--> wraps a part of a <table>, and pasting it into non-table element, necessary table structure element such as <table> and/or <tr> elements should be added by our editor.

Yes. From how I understood the code, it's intended to already deal with that case, when parsing the pasted clipboard data in HTMLEditor::ParseCFHTML. It should be part of the context which should then take a similar code-path like in the case of bug 1639972.
However, I'm not entirely sure that's the bug. Currently, I can't exclude that some JS of the website biases the pasting.

Assignee: nobody → mbrodesser

A file to use to fill the clipboard's "text/html" flavor to reproduce the issue on Ubuntu.
It contains the content of c2, minus some information which prevented reproducing the issue on Ubuntu. Use xclip to feed this to the clipboard: xclip -selection clipboard -t text/html -i import-to-clipboard.html.

Webcompat Priority: ? → P3

The JS of Word Online listens to the paste event and seems to transform the event's data. Therefore, this seems to be a bug in Word Online's JS.

Stacktrace excerpt from a Pernosco run:

mozilla::EditorEventListener::KeyPress () at EditorEventListener.cpp:656
::WidgetKeyboardEvent::ExecuteEditCommands () at WidgetEventImpl.cpp:861
mozilla::DoCommandCallback () at EditorEventListener.cpp:88
nsBaseCommandController::DoCommand () at nsBaseCommandController.cpp:114
nsControllerCommandTable::DoCommand () at nsControllerCommandTable.cpp:138
::EditorCommand::DoCommand () at EditorCommands.cpp:65
::PasteCommand::DoCommand () at EditorCommands.cpp:467::TextEditor::PasteAsAction () at TextEditorDataTransfer.cpp:579
::TextEditor::FireClipboardEvent () at TextEditor.cpp:1170
nsCopySupport::FireClipboardEvent () at nsCopySupport.cpp:809
::EventDispatcher::Dispatch () at EventDispatcher.cpp:1092
::EventTargetChainItem::HandleEventTargetChain () at EventDispatcher.cpp:590

The website get's the event's data via DataTransfer::GetData, which has the following JS stack:
retrieved via call DumpJSStack():

0 GA(a = "[object DataTransfer]", b = ""text/html"") ["https://c1-word-edit-15.cdn.office.net/we/s/hD8242D1F801EA11B_App_Scripts/WordEditor.js":3023:404]
    this = [object Object]
1 wac_Rwb(a = "[object Object]", b = "[object DataTransfer]", c = "[object Object]") ["https://c1-word-edit-15.cdn.office.net/we/s/hD8242D1F801EA11B_App_Scripts/WordEditor.js":5643:120]
    this = [object Window]
2 wac_ewb(a = "[object Object]", b = "[object Object]", c = "[object Object]", d = "[object DataTransfer]", e = "4034531111") ["https://c1-word-edit-15.cdn.office.net/we/s/hD8242D1F801EA11B_App_Scripts/WordEditor.js":5648:451]
    this = [object Window]
3 wac_M$a/b.PMc(b = "[object Object]") ["https://c1-word-edit-15.cdn.office.net/we/s/hD8242D1F801EA11B_App_Scripts/WordEditor.js":5552:487]
    this = [object Window]
4 wac_Epa(a = "function(b){wac_ewb(a.Oda,b,a.Re.zg,\na.Kd.sQb,a.Kd.t7b)}", b = "0", c = "[object Object]") ["https://c1-word-edit-15.cdn.office.net/we/s/hD8242D1F801EA11B_App_Scripts/WordEditor.js":934:86]
    this = [object Window]
5 wac_xpa(a = "[object Object]", b = "[object Object]", c = ""paste"", d = "[object Object]") ["https://c1-word-edit-15.cdn.office.net/we/s/hD8242D1F801EA11B_App_Scripts/WordEditor.js":935:366]
    this = [object Window]
6 Ecf/<() ["https://c1-word-edit-15.cdn.office.net/we/s/hD8242D1F801EA11B_App_Scripts/WordEditor.js":930:292]
    this = [object Window]
7 iPa(a = [function], b = ""paste / DIV[WACViewPanel_EditingElement]"", c = "0", d = "null") ["https://c1-word-edit-15.cdn.office.net/we/s/hD8242D1F801EA11B_App_Scripts/WordEditor.js":700:98]
    this = [object Object]
8 Ecf(a = "[object Object]", b = "[object Object]") ["https://c1-word-edit-15.cdn.office.net/we/s/hD8242D1F801EA11B_App_Scripts/WordEditor.js":930:270]
    this = [object Object]
9 Function.createDelegate/<("[object Object]", "[object Object]") ["https://c1-officeapps-15.cdn.office.net/we/s/hEC3E0FECD8521498_App_Scripts/MicrosoftAjax.js":5:306]
    this = [object Window]
10 wac_Tpa/<(c = "[object Object]") ["https://c1-word-edit-15.cdn.office.net/we/s/hD8242D1F801EA11B_App_Scripts/WordEditor.js":1216:360]
    this = [object HTMLDivElement]
11 b(b = "[object ClipboardEvent]") ["https://c1-officeapps-15.cdn.office.net/we/s/hEC3E0FECD8521498_App_Scripts/MicrosoftAjax.js":5:57481]
    this = [object HTMLDivElement]

In order to fix this bug, it needs to be understood how Word Online's JS transforms the clipboard-data and why the behavior seems to differ (and work) for Chrome. Will try to reach out to some developer of Word Online.

Summary: The user is unable to copy a table from Microsoft Excel to Microsoft's online Word → The user is unable to copy a table from Microsoft Excel to Microsoft Word Online

From an E-Mail of a Microsoft developer:

"Regarding the issue of pasting Excel tables into Word Online: we are aware of the issue and cause and are investigating a fix to Word Online’s code."

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → ASSIGNED
Status: ASSIGNED → NEW

Excerpt from an E-Mail from a Microsoft developer:

"For what it's worth, we don't have a timeline for the fix right now, but know what needs to be done."

Used another feedback system from Microsoft (the one from Microsoft Word Online) to report the issue, recommended by a Microsoft developer.

Rares: can you please check if the issue still occurs?

Flags: needinfo?(rares.doghi)

Yes this issue still occurs in our latest Nightly Build 91.0a1 (2021-06-14).

Flags: needinfo?(rares.doghi)

I've reminded Microsoft developers about this issue in order to determine if and when they'll work on it.

Microsoft developers have a fix pending for this.

(In reply to Rares Doghi from comment #12)

Yes this issue still occurs in our latest Nightly Build 91.0a1 (2021-06-14).

Hi Rares,
Can you please help test if this is still valid? Thanks.

Flags: needinfo?(rares.doghi)

This issue still occurs in our latest Nightly build 97.0a1 (2022-01-09).

Flags: needinfo?(rares.doghi)

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: mbrodesser → nobody
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: