Closed Bug 103522 Opened 23 years ago Closed 22 years ago

copying from tables adds no whitespace between cells

Categories

(Core :: DOM: Selection, defect)

x86
Windows 98
defect
Not set
major

Tracking

()

RESOLVED DUPLICATE of bug 94176
Future

People

(Reporter: jruderman, Assigned: mjudge)

References

Details

Steps to reproduce: 
Select a few lines of a table in a bug list and paste them into a text editor.  
Or, select a few columns of a bug list (by holding control as you make the 
selection).

Result:

27610 norP3VERIDUPLUser Int0---DOS shortcuts for cut, copy, paste not 
implemented 27655 triP3VERIFIXEBrowser-0---Can copy empty string from location 
bar 28759 enhP3VERIWONTNetworki0---[enhancement] geturl.exe: http headers 28763 
norP2NEWQuery/Bu1Bugzilla 2.16Query page, location of submit button 

I get the same result whether I use normal text selection (click-drag) or table 
cell selection (ctrl+click-drag).

Expected result:

27610  nor P3 VERI DUPL User Int 0 --- DOS shortcuts for cut, copy, paste not 
implemented  
27655  tri P3 VERI FIXE Browser- 0 --- Can copy empty string from location bar  
28759  enh P3 VERI WONT Networki 0 --- [enhancement] geturl.exe: http headers  
28763  nor P2 NEW  Query/Bu 1 Bugzilla 2.16 Query page, location of submit 
button

[a space between two cells in the same row, and a newline between two cells in 
different rows.]

or

27610  nor P3 VERI DUPL User Int 0 --- DOS shortcuts for cut, copy, paste not 
implemented  
27655  tri P3 VERI FIXE Browser- 0 --- Can copy empty string from location bar  
28759  enh P3 VERI WONT Networki 0 --- [enhancement] geturl.exe: http headers  
28763  nor P2 NEW       Query/Bu 1 Bugzilla 2.16 Query page, location of submit 
button

[extra spaces added to make the columns line when in a fixed-width font is used]
Depends on: 94176
Space padding table cells is next to useless if you expect to actually DO
anything with the cells afterwards. I think it should really be a tab placed in
between cells in the same row. That way Excel will get the hint when you decide
to paste the cells into a worksheet. If people want to reformat from there,
that's cool.

And I agree, this IS a major bug. Copy and paste of selections should work with
no problems, no matter what's being selected. Right now selecting anything in a
table doesn't yield anything useful, so you pretty much can't do it.
pretty printing of selection marking as future
Target Milestone: --- → Future
Nick: I'd prefer if Mozilla didn't use tabs between cells.  I often only copy 
one or two rows, in which case tabs would be ugly.  (Tabs are often ugly when 
pasting an entire table as well, because they stagger the columns by random 
multiples of 5 or 8 spaces.)  Can we give Excel something other than text/plain 
so that the table cell pattern can be retained exactly *when pasting into 
Excel*?

mjudge: This isn't "pretty printing of selection", it's being able to copy text 
out of tables.
Jesse: I agree completely, this bug is really important. Copying text out of
tables right now yields gibberish. It is 100% broken.

I can see your point about copying out a few lines of text to paste into an
e-mail or something. However, it seems to me that it would be a simple matter of
find/replacing the tabs to remove them. Or you could paste them into Excel and
export a space-delimited file. Or you could use the fmt command in Unix to make
the spaces into tabs. There are lots of solutions for this problem because the
standard way of representing a table in text format is using tabs and newlines.

The point, really, is that it's almost impossible to get the tabs in there if
they aren't added by the browser, while taking them out is trivial. Imagine
copying a table the size of some large Bugzilla querys. Would you want to go
through and figure out which spaces needed to be tabs so you could import that
into Excel, if indeed that's what you wanted to do with it? It would be faster
to write a Perl script to do that for you, or even to parse the HTML.

FWIW, IE5 Mac adds tabs between cells. I think Mozilla should too.
*** Bug 122002 has been marked as a duplicate of this bug. ***
*** Bug 72605 has been marked as a duplicate of this bug. ***
*** Bug 136830 has been marked as a duplicate of this bug. ***
This is actually a jfrancis bug: the document encoder isn't including the <td>
or <tr> information into the copy context so that the serializer knows to insert
the correct whitespace.

*** This bug has been marked as a duplicate of 94176 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
Akkana's comment is incorrect.  The encoder is doing the right thing.  Between 
her code and my code thought, the clipboard and parser are involved.  The parser 
is the one dropping the table structure.  See bug 94176.
You need to log in before you can comment on or make changes to this bug.