Bug 46607 - EDITING: Background colors in HTML table cells are not copied from Firefox/Chrome
Summary: EDITING: Background colors in HTML table cells are not copied from Firefox/Ch...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.3.4 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks: HTML-Paste
  Show dependency treegraph
 
Reported: 2012-02-25 02:34 UTC by danielax
Modified: 2021-06-11 06:52 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Example HTML table with cell brackground colours (3.01 KB, text/html)
2021-06-11 06:51 UTC, Stéphane Guillou (stragu)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description danielax 2012-02-25 02:34:56 UTC
Problem description: 

When attempting to paste in a HTML table copied from Firefox or Chrome on Mac OS X, the background colours of cells are lost.

Steps to reproduce:
0. Create a blank, empty spreadsheet.

1. With Firefox or Chrome, select and copy a table, or part thereof, that contains cells with a background colour. I'm using <http://dja.ucc.asn.au/spreadsheetbug.html> because I'm using it in another bug report (#46605). 
[Note you may need to tell your browser to view my page as unicode: the first column should be a triangle, not gibberish]

2. Click on A1, paste.

Current behavior:
Background colours are lost. All other formatting is OK.

Expected behavior:
The pasted table is equivalent to the HTML table. 

Note that pasting the same thing into TextEdit keeps the background colour, so it is making it into the clipboard and not getting dropped at the browser.

[This bug does not affect copying from Safari. However, copying from that results in a different bug: #46605.]

Platform (if different from the browser): Mac OS X 10.6.8
              
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11
Also affects Firefox 10.0.2
Comment 1 sasha.libreoffice 2012-05-24 03:42:39 UTC
Thanks for bugreport
Reproduced in 3.3.4 and 3.5.3 on Fedora 64 bit and in 3.5.2 on Windows 7 32 bit
In both cases copied from Firefox
Changing version to 3.3.4 as most early reproducible

What is interesting: LibreWriter and msExcel 2007 paste this as plain text
Comment 2 retired 2014-12-11 11:33:21 UTC
works when pasting to excel 2011 for OSX

OSX 10.10.1, LO Version: 4.5.0.0.alpha0+
Build ID: 6e91763769a562b88882a4c2a94b1367c6ed4866
TinderBox: MacOSX-x86_64@49-TDF, Branch:master, Time: 2014-12-11_02:24:05
Locale: de_

persisting. no background color is pasted.
Comment 3 QA Administrators 2015-12-20 16:07:52 UTC Comment hidden (obsolete)
Comment 4 QA Administrators 2017-01-03 19:46:42 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2020-09-28 03:55:42 UTC Comment hidden (obsolete)
Comment 6 Stéphane Guillou (stragu) 2021-06-11 06:51:00 UTC
Created attachment 172787 [details]
Example HTML table with cell brackground colours

The original link is dead, so we can't investigate what the original HTML code looked like.

I am adding an example table with coloured backgrounds (created with LO Writer 70 and saved as HTML) for testing purposes.

Steps to reproduce:

1. Open example file in web browser (try Chrome and Firefox)
2. Select whole table (or use Ctrl + A) and copy
3. Paste into new Calc spreadsheet

I couldn't reproduce this bug on Linux with Firefox 89, Chrome  the three following versions of LO:

Version: 7.0.6.2
Build ID: 144abb84a525d8e30c9dbbefa69cbbf2d8d4ae3b
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Version: 7.1.3.2 / LibreOffice Community
Build ID: 47f78053abe362b9384784d31a6e56f8511eb1c1
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Version: 7.2.0.0.alpha1+ / LibreOffice Community
Build ID: 7f3c9da5a0a8f27e3fe63c39a30fc08e34246420
CPU threads: 8; OS: Linux 4.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-06-10_17:32:52
Calc: threaded

So it looks like LO now does take into account the <td> bgcolor attribute as expected. You can also test with this w3schools example:

http://w3schools-fa.ir/tags/tryit4dff.html?filename=tryhtml_td_bgcolor
Comment 7 Stéphane Guillou (stragu) 2021-06-11 06:52:33 UTC
Changing title as it didn't just affect MacOS.

Marking as RESOLVED - WFM as I can't reproduce, but would appreciate someone also testing on MacOS just in case.