Open Bug 237546 Opened 21 years ago Updated 3 years ago

copy table to clipboard loses formatting information, i.e. background color

Categories

(Firefox :: General, defect)

x86
Windows XP
defect

Tracking

()

People

(Reporter: sschram, Unassigned)

References

()

Details

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8 Copying any element of tables on this site (or other Mantis php-generated pages) results in mostly useless strings of text. No line feeds, colors, fonts, etc. are put into the clipboard. Using the CTRL-select method isn't any better. In general, it seems like the copy-to-clipboard functionality needs some work. Reproducible: Always Steps to Reproduce: 1. bring up page referenced above 2. select a few cells of any of the tables 3. copy by any method (right-click-copy, Edit-Copy, Ctrl-C) 4. paste into text editor (Notepad), spreadsheet (Excel), or document editor (Word) Actual Results: The text editor and document editor showed a continuous line of unformatted text. The spreadsheet entered all of the text into one cell. Expected Results: The text editor should reveal a crude representation of the original table. The document editor and spreadsheet should have a nearly-exact copy of the table. I noted other bugs that were similar, but made no mention of the lack of formatting (i.e. colors).
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040313 Firefox/0.8.0+ WORKSFORME: On notepad. No colors, but that's normal. Unable to test on office. Reporter, can you test on the latest build from http://ftp.mozilla.org/pub/mozilla.org/firefox/nightly/latest-trunk/ and report back if you still have this problem? Thank you.
My mistake. Pasting into Notepad works as well as can be expected given the limitations of a plain text editor. I did test with the newer version and I see the same behavior as with the 0.8 release. If you don't have any program which will accept formatted text from the clipboard, I guess you won't be able to see what I'm seeing. For what it's worth, I played a little with WordPad and found that it doesn't do well accepting formatted text (from I.E. or FireFox). It actually works a little better with Firefox than it does with I.E. This may be something to chalk up to MS I.E. playing well with MS Office. It may be too difficult for anyone but MS to mimic.
Is this still a prob in 0.9?
(In reply to comment #3) > Is this still a prob in 0.9? Yes. I don't see any improvement in this area.
Its still a prob in 0.9.2 too. Tested with MS Windows XP. All data lose their format and become pure text.
... this problem does not exist in Mozilla 1.7. Mozilla 1.7 copies all data correctly.
I see the bug as well. Confirmed!
Status: UNCONFIRMED → NEW
Ever confirmed: true
Still a problem in Firefox 1.0PR
This is happening on Firefox PR 1.0 on OS X. Link locations, fonts, etc are not preserved when copying from firefox and pasting.
In Linux, copying a table to OpenOffice.org's spreadsheet program works just fine, unless you hold down CTRL to select only a subset of the columns in the table. (Without CTRL, you can only select all columns of n rows where n > 1). When holding down CTRL, the pasted data does not retain all of its table layout info. Specifically, it all pastes into a single row even when multiple rows were selected. Maybe that should be a separate bug??
This is similar to Bug 137450 and Bug 173388. The resolution of 173388 was to write Tabs as separators between cells. This made paste into NotePad or Wordpad work. However, it did not fix pasting into MS Excel, where everything gets jammed into a single cell. So perhaps the cell and row separators should be something else. Or the clipboard format should be something else. I have had success pasting into WordPad and copying again to paste into MS Excel XP. Seems a round-about hack, but it works. I note that nsPlainTextSerializer.cpp doesn't recognize the HTMLClipboardFormat. It would sem to me that using that format to paste from an HTML document onto the clipboard would take care of the problem -- with the MSAPI doing all the work on pase into the MS Apps. Unfortunately, I'm just a novice Visual C++ programmer and don't know where any of the FireFox or Mozilla code resides (I can't find about six modules included in the nsPlainTextSerializer.cpp build or I'd at leas try for a fix). So someone with a little more facility than I should look into whether this would be a fruitful direction for followup.
For me, more important is that copying table to clipboard creates a _single line_ from the whole table. This bug makes the copy function quite useless. Don't know about firefox older than 1.0.2, but this bug (or 'feature') wasn't present in mozilla
I'm working on a patch for bug 137450, but it won't fix everything this bug reports. It should allow you to copy and paste table cells and keep them separated, but it probably won't save all the formatting, since that's all in stylesheets. Hopefully I'll look into that once I get the first part fixed.
This bug seems to depend on two things. First, the TABLE tag does not appear to be copied when only a few TR's or TD's are copied. Copying that would make the pasted table look like a table. Second, to copy the formatting, that may be a style sheet issue. It is a pretty big problem for my organization that relies on tables a lot. Good luck with 137450!
In case I haven't made it clear here, IE always copies the HEAD element to the clipboard when you copy HTML, so style information gets saved.
I would confirm this report. While trying to copy the 1 minute sample size table from this website (http://service.real.com/help/content/audiohints.html), I went to paste it into Excel and it was just 1 long line of ****. Same things have happened at other sites that had the information formatted as a table & you paste in Excel, and it goes down to 1 line of text. Workaround 1: Paste into notepad & hope formatting worked there, then paste into Excel... though you lose Bold, formatting, etc Workaround 2: Use M$ Internet Explorer for that page... lesser or 2 evils?
if you want to paste the table in excell, you can choose Paste Special, select Text. This way we won't loose the table format, but we will loose the formating.
Assignee: bross2 → nobody
QA Contact: general
Possible workaround: Table2Clipboard extension (https://addons.mozilla.org/firefox/addon/1852).
This reproduces in FireFox 4b12. Go to about:support, select the Hardware Acceleration table at the bottom, press Ctrl+C, open Notepad, press Ctrl+V - One line of text with no spaces between the cells/new lines between the rows. Related/duplicated issues - https://bugzilla.mozilla.org/show_bug.cgi?id=638439 https://bugzilla.mozilla.org/show_bug.cgi?id=572543 https://bugzilla.mozilla.org/show_bug.cgi?id=137450 https://bugzilla.mozilla.org/show_bug.cgi?id=303736 https://bugzilla.mozilla.org/show_bug.cgi?id=515464
Assignee: nobody → netzen
Assignee: netzen → nobody
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.