After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 564166 - Copying a tabular area just moves text to the clipboard
Copying a tabular area just moves text to the clipboard
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: General
1.9.x
Other Windows
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2008-12-11 18:55 UTC by Paul Nielsen
Modified: 2009-02-11 13:18 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to try (2.06 KB, patch)
2009-02-06 18:19 UTC, Morten Welinder
none Details | Review
Pasted data (3.50 KB, application/octet-stream)
2009-02-06 20:44 UTC, Morten Welinder
  Details
On Windows, use Windows format names for html, open document. (785 bytes, patch)
2009-02-07 11:14 UTC, Jon Kåre Hellan
none Details | Review
Missed a few places where "text/html" was used (1.39 KB, patch)
2009-02-07 13:12 UTC, Jon Kåre Hellan
none Details | Review
Updated patch (2.90 KB, patch)
2009-02-10 18:00 UTC, Morten Welinder
committed Details | Review

Description Paul Nielsen 2008-12-11 18:55:10 UTC
Version is 1.9.3 of 20081017 from http://www.gnome.org/~jody/gnumeric/win32/

When an area of mxn cells is highlighted and copied, only the raw data is copied, so it can't be pasted into other applications as a table, as is possible with Excel.  

Specifically I am trying to paste into an Open Office 3 text document, and I can only paste the data as a table by pasting first into Excel, and then from Excel into Open Office Writer.

Is it planned to be able to paste as tables?
Comment 1 Jody Goldberg 2008-12-11 19:28:05 UTC
It is supported in several formats.
The open question is what formats OOo Writer recognizes.
Comment 2 Paul Nielsen 2008-12-11 20:10:36 UTC
I have tried paste special into Excel, after copying from my table in Gnumeric.  When I do this, Excel 2000 opens a window which gives the choices of "Unicode Text" or "Text"  Neither of these carries the table information, and Excel just accepts either of these as space delimited text and makes a new table without any of the Gnumeric formatting.

When I paste into SeaMonkey Composer I have the choices of paste or paste without formatting.  The "paste without formatting" looks ok, but doesn't create a table (as pasting from Excel does).  The paste option creates a full screen of Chinese looking characters.

When I chose "paste special" with Open Office Writer only the choice "Unformatted Text" appears, with the source listed as unknown.  

If I do the same with the same rows and columns copied from Excel, the Source is listed as Sheet1!R1C10:R41C16, and there are possible selections of:

GDI metafile
HTML format
HTML format without comments
Unformatted text
Formatted text (RTF)
Microsoft Excel Worksheet
DDE link

The "Formatted text (RTF)" and "Microsoft Excel Worksheet" options both give table views of the source data.

I have also tried the windows clipboard viewer (C:\WINNT\system32\clipbrd.exe) which instantly displays the data from a copy operation.  This does not seem to maintain any detailed formatting information from Excel (the Excel and Gnumeric views look just the same.)

So it seems to me that this Windows version of Gnumeric is not keeping the information needed for a fully characterized paste operation.
Comment 3 Andreas J. Guelzow 2009-02-04 08:31:08 UTC
Copying data from Gnumeric clearly provides many formats many of them preserving the table format. This really seems like an openoffice bug not to recognize those formats.
Comment 4 Jon Kåre Hellan 2009-02-04 12:23:05 UTC
This is known to work on Linux, but obviously not in Windows. Underlying clipboard mechanisms are very different on those platforms, so it isn't surprising that there are problems here.

It's probably a question of guessing the right format name. On Unix, we use mime
types. I don't see a direct way to tell what name the other applications are
expecting, but we can see what they offer when we try to paste from them.

Could the next person to make a build for Windows change the #if 0 at gui-clipboard.c l. 436 to #if 1?

A user could then mark a table in firefox, excel or openoffice, and paste it into
gnumeric. If gnumeric is started from a command line window, a list of formats would then be printed to the command line window. I would like to see:

- What format names are printed when pasting a table from firefox?
- What format names are printed when pasting a table from openoffice writer?
- What format names are printed when pasting a cell range from excel?
- What format names are printed when pasting a cell range from openoffice calc?

Comment 5 Morten Welinder 2009-02-05 13:57:44 UTC
Debug code is in.

   set GNM_DEBUG=clipboard

to activate.
Comment 6 Jody Goldberg 2009-02-06 03:46:45 UTC
The debug build is up.   I'll try to install on a box with MS office after the 17th.
Comment 7 sum1 2009-02-06 16:05:17 UTC
I tested with gnumeric-1.9.4-20090205-debug.exe and the following grid:

"A1"	"B1"	"C1"
"A2"	"B2"	"C2"
"A3"	"B3"	"C3"


--Copying in Gnumeric--

** Message: clipboard target=UTF8_STRING
** Message: clipboard text of 26 bytes


--Copying from OpenOffice.org Calc 3.0.1--

Clipboard target 0 is UTF8_STRING
Clipboard target 1 is DataObject
Clipboard target 2 is Star Embed Source (XML)
Clipboard target 3 is Star Object Descriptor (XML)
Clipboard target 4 is GDIMetaFile
Clipboard target 5 is Windows Bitmap
Clipboard target 6 is HTML (HyperText Markup Language)
Clipboard target 7 is HTML Format
Clipboard target 8 is Link
Clipboard target 9 is Rich Text Format
Clipboard target 10 is Ole Private Data
Clipboard target 11 is image/bmp
---> CRASH in libpixbufloader-gdip-bmp.dll


--Copying from OpenOffice.org Writer 3.0.1--

Clipboard target 0 is UTF8_STRING
Clipboard target 1 is DataObject
Clipboard target 2 is Star Embed Source (XML)
Clipboard target 3 is Star Object Descriptor (XML)
Clipboard target 4 is Rich Text Format
Clipboard target 5 is HTML (HyperText Markup Language)
Clipboard target 6 is HTML Format
Clipboard target 7 is Link
Clipboard target 8 is Ole Private Data
---> Text Import Configuration dialog pops up with 9 lines in it


--Copying from Excel 2003--

Clipboard target 0 is UTF8_STRING
Clipboard target 1 is DataObject
Clipboard target 2 is Biff8
Clipboard target 3 is Biff5
Clipboard target 4 is Biff4
Clipboard target 5 is Biff3
Clipboard target 6 is Biff
Clipboard target 7 is Wk1
Clipboard target 8 is XML Spreadsheet
Clipboard target 9 is HTML Format
Clipboard target 10 is Csv
Clipboard target 11 is Rich Text Format
Clipboard target 12 is Embed Source
Clipboard target 13 is Native
Clipboard target 14 is OwnerLink
Clipboard target 15 is Object Descriptor
Clipboard target 16 is Link Source
Clipboard target 17 is Link Source Descriptor
Clipboard target 18 is Link
Clipboard target 19 is ObjectLink
Clipboard target 20 is Ole Private Data
Clipboard target 21 is image/bmp
---> Cells A1:C3 are pasted correctly


--Copying from Firefox 3.0.6 (with a valid XHTML 1.0 Strict file)--

Clipboard target 0 is UTF8_STRING
Clipboard target 1 is DataObject
Clipboard target 2 is text/html
Clipboard target 3 is HTML Format
Clipboard target 4 is text/_moz_htmlcontext
Clipboard target 5 is text/_moz_htmlinfo
Clipboard target 6 is text/x-moz-url-priv
Clipboard target 7 is Ole Private Data
HTML parser error : htmlParseStartTag: invalid element name
^
HTML parser error : htmlParseStartTag: invalid element name
^
HTML parser error : htmlParseStartTag: invalid element name
[repeated]
---> Text Import Configuration dialog pops up with 3 lines in it


Backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x6b8824e6 in gdip_buffer_to_bitmap (buffer=0x1f35bc8 "BM6\231", size=39222, 
    error=0x22f22c) at io-gdip-utils.c:356
        in io-gdip-utils.c
(gdb) 356       io-gdip-utils.c: No such file or directory.
bt
  • #0 gdip_buffer_to_bitmap
    at io-gdip-utils.c line 356
  • #1 gdk_pixbuf__gdip_image_stop_load
    at io-gdip-utils.c line 811
  • #2 gdk_pixbuf_loader_close
    at gdk-pixbuf-loader.c line 723
  • #3 soi_get_pixbuf
    at sheet-object-image.c line 258
  • #4 gnm_soi_default_size
    at sheet-object-image.c line 608
  • #5 sheet_object_default_size
    at sheet-object.c line 649
  • #6 scg_image_create
    at sheet-control-gui.c line 3175
  • #7 scg_paste_image
    at sheet-control-gui.c line 3188
  • #8 image_content_received
    at gui-clipboard.c line 314
  • #9 selection_received
    at gtkclipboard.c line 859
  • #10 _gtk_marshal_VOID__BOXED_UINT
    at gtkmarshalers.c line 1461
  • #11 g_closure_invoke
    at gclosure.c line 767
  • #12 signal_emit_unlocked_R
    at gsignal.c line 3244
  • #13 g_signal_emit_valist
    at gsignal.c line 2977
  • #14 g_signal_emit_by_name
    at gsignal.c line 3071
  • #15 gtk_selection_retrieval_report
    at gtkselection.c line 2918
  • #16 _gtk_selection_notify
    at gtkselection.c line 2724
  • #17 _gtk_marshal_BOOLEAN__BOXED
    at gtkmarshalers.c line 84
  • #18 g_type_class_meta_marshal
    at gclosure.c line 878
  • #19 g_closure_invoke
    at gclosure.c line 767
  • #20 signal_emit_unlocked_R
    at gsignal.c line 3282
  • #21 g_signal_emit_valist
    at gsignal.c line 2987
  • #22 g_signal_emit
    at gsignal.c line 3034
  • #23 gtk_widget_event_internal
    at gtkwidget.c line 4745
  • #24 gtk_widget_event
    at gtkwidget.c line 4542
  • #25 gtk_main_do_event
    at gtkmain.c line 1574
  • #26 gdk_event_dispatch
    at gdkevents-win32.c line 3804
  • #27 g_main_dispatch
    at gmain.c line 2144
  • #28 g_main_context_dispatch
    at gmain.c line 2697
  • #29 g_main_context_iterate
    at gmain.c line 2778
  • #30 g_main_loop_run
    at gmain.c line 2986
  • #31 gtk_main
    at gtkmain.c line 1200
  • #32 main
    at main-application.c line 508

Comment 8 Morten Welinder 2009-02-06 17:59:09 UTC
Excellent.  It looks like some of the target atom names are different
under Windows.

#define OOO_ATOM_NAME "application/x-openoffice;windows_formatname=\"Star Embed Source (XML)\""

--> just "Star Embed Source (XML)"



#define HTML_ATOM_NAME "text/html"

--> "HTML (HyperText Markup Language)" and "HTML Format".
Comment 9 Morten Welinder 2009-02-06 18:19:39 UTC
Created attachment 128105 [details] [review]
Patch to try

This might fix the input side.
Comment 10 Morten Welinder 2009-02-06 20:44:26 UTC
Created attachment 128112 [details]
Pasted data
Comment 11 Jon Kåre Hellan 2009-02-06 22:35:18 UTC
Committed a fix to the html problem in comment #7. Had to make detection of
16 bit unicode without byte order mask more robust.
Comment 12 Jon Kåre Hellan 2009-02-07 11:14:47 UTC
Created attachment 128148 [details] [review]
On Windows, use Windows format names for html, open document.

This should do the following
- export & import html to windows apps. Unless they insist on 16 bit unicode, 
  that is.
- import native openoffice format just as well or poorly as we do on Linux.
Adding export to Excel looks easy to do. But how many users have 2 different spreadsheet apps open at the same time?
Comment 13 Jon Kåre Hellan 2009-02-07 13:12:08 UTC
Created attachment 128157 [details] [review]
Missed a few places where "text/html" was used
Comment 14 Morten Welinder 2009-02-07 15:01:08 UTC
jk: I thought about doing it that way, but I couldn't convince myself that no
windows program would say "text/html", so my patch would accept either
version (independent of OS).
Comment 15 Morten Welinder 2009-02-10 18:00:20 UTC
Created attachment 128397 [details] [review]
Updated patch

How about this?
Comment 16 Jon Kåre Hellan 2009-02-10 21:38:50 UTC
Looks good.
Comment 17 Morten Welinder 2009-02-11 13:18:34 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.