GNOME Bugzilla – Bug 651260
Pasting a cell with Comment from Excel results in an empty comment in Gnumeric
Last modified: 2011-08-22 05:44:34 UTC
Created attachment 188766 [details] Comment in Excel xls spreadsheet This can be reproduced easily (by someone using Windows :) ). This only happens when saving as ODS (with or without foreign elements) Steps 1) Copy a cell with a comment from an Excel spreadsheet (see attached file) loaded in Excel (I am using Office 2003) 2) Paste into Gnumeric 3) Save as ODS Interesting facts: 1) If the Excel file is opened in Gnumeric, it doesn't produce a crash 2) If the file is saved as .gnumeric, it doesn't produce a crash This probably means that it is some code exported by the Excel clipboard that the ODS format doesn't support? (I'm using Gnumeric 1.10.15 under Windows XP SP3)
A few questions: 1) Would you be able to create a backtrace of the crash? 2) After you pasted the cell into Gnumeric, do you still have a comment? 3) How does the pasted comment look like? 4) Do you see any difference between the pasted comment and one created inside Gnumeric? Thank you
Hi Andreas 1) Of course. Just tell me what to do. 2) No. I didn't notice that before. 3) The comment doesn't show up. In fact if I choose Edit Comment it will show a blank box. 4) Visually the cells looks exactly the same. A red corner triangle. But the pasted cell contains no text. Thank *you* for Gnumeric ;)
Hi Pedro, re 1) I have no idea how to do that (or virtually anything else) on MS Windows. Your answers to 2,3, and 4 are very useful. I suspect that when we are writing the comment we are encountering an unexpected NULL. Clearly something is going badly wrong when the cell is pasted.
I have reviewed the code in the ODF exporter that writes the comments and included some more checks (ie. made less assumptions). We will need to see whether this avoids the crash. (Of course there is still the issue of getting an empty comment in the first place.)
Adding Jean -- we need someone who can reproduce. (I do not have both Gnumeric and Excel on any single machine.) Pedro: can you please attach the resulting .gnumeric file? There might be hints in that.
I can only create a gnumeric file resulting from pasting within gnumeric (but you can do the same). There is no file output after pasting from Excel because Gnumeric crashes on Save :) I can Paste from Excel and Save as .gnumeric though. Does that help?
Hmm, no excel around. Can't test.
> I can Paste from Excel and Save as .gnumeric though. Does that help? It might, so please do so.
Created attachment 189031 [details] Comment pasted from Excel As mentioned before, pasting a cell with a Comment and saving as .gnumeric doesn't produce a crash but the Comment is not copied. I don't know if this has any influence but the comment in Excel doesn't have an Author.
Thanks. The relevant part of the file is: <gnm:Objects> <gnm:CellComment ObjectBound="B2" ObjectOffset="1 0 1 0" Direction="17" Print="1"/> </gnm:Objects> Note that there is no text. Andreas: I believe this was the case you fixed recently. Right?
I fixed the ODF exporter crashing if there is no text. So the crash ought to be fixed. Of course there is still the problem that the text disappears on the paste in the first place. If there is no text at all we should not have a comment.
Actually the crash seems to be caused by the missing Author. I just pasted from Excel an empty comment with Author and it saved correctly as .ods Then I pasted the comment from the uploaded Excel file and it crashed again.
My commit covered author, text and markup. We always tested whether author and/or text was NULL so that could not have been the direct reason for the crash. Of course we don't know what happened when the comment was pasted that made it have the comment text disappear in the first place.
Here's a non-debug backtrace with gnumeric-1.10.15-20110524.exe: Program received signal SIGSEGV, Segmentation fault. [Switching to thread 1212.0xd20] 0x77c478c0 in strlen () from C:\WINDOWS\system32\msvcrt.dll (gdb) bt
+ Trace 227374
Here are the steps I'm using: - Open Gnumeric - Copy cell B2 from Attachment 188766 [details] with Excel 2003 SP3 - Paste into cell A1 in Gnumeric - File > Save As - Select 'ODF/OpenOffice with foreign elements' as the file type - Press Save --> Crash
sum1, thanks. That's what I fixed already (post-gnumeric-1.10.15-20110524).
Hi sum1 Would you mind writing a detailed step-by-step tutorial (or pointing me to an existing one) on how to create the backtrace log under Windows? Thanks! ;)
1.10.16 was just released with a MSWindows binary available on our website. Could somebody test whether (a) the crash described in this bug report still happens (b) pasting a cell with a non-empty comment creates a non-empty comment (or no comment at all) Thank you
Of course I'm available for testing. It wouldn't make sense otherwise, would it? ;) (a) Gnumeric no longer crashes (well done!) (b) pasting a cell with a non-empty comment creates an empty comment; pasting a cell with an empty comment creates an empty comment. The author name is transferred. Conclusion: comment contents are not transferred :)
I have just tested with 1.10.16, Win7, and Excel2007 (no xl2003 around). (a) No crash happened (b) An empty comment is created. The saved file is opened by Gnumeric without complains. Excel2007 writes on opening the following. Excel found unreadable content in 'Työkirja2.ods'. Do you want to recover the contents of theis workbook? If you trust the source of this workbook, click Yes. (This is in a Finnish locale, thus the name of the workbook.) After clicking Yes, excel writes: Excel was able to open the file by repairing or removing the unreadable content. Then, same previous message with additional explanation: Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded. Also, a link to the log file listing repairs is given. That file contains xml text with the error and explanation of it... Next, the file is opened and has an empty comment for the A1 cell. PS. There've been a collision in the air with Pedro's comment ;-)
Since only (b) is left I retitled and assigned to xl import. There is no ODF issue left here.
Checked clipboard made by Excel2003. As usual it has multiple copies of the same (more or less) content in different formats. In my case 2nd (counting from 0) entry is "biff8", nexts are "biff5","biff4","biff3" and "biff". Entry 10 is "XML Spreadsheet". Entries 15 and 16 are "Embed Source" and "Native", both of them are actually biff8 files. All biffs in that file have comment text EXCEPT for 'biff8' in the 2nd entry -- this one only have cell text and comment author.
Our code has preference for biff8. So we end up without comment text. What would be be losing if we switched preference to biff5? @Valek, what are entries 0 and 1?
Entry 0 has a description 'Data Object', content is just 4 bytes ('ba 05 01 00'). Entry 1 is WMF file (description '&Picture'), it doesn't have neither comment author nor comment text inside.
Created attachment 194339 [details] [review] patch to favour xlsx over biff8 @Valek, could you give this patch a try please. We also need to know whether anything else breaks when copied...
Created attachment 194344 [details] XML part of the clipboard
Comment on attachment 194339 [details] [review] patch to favour xlsx over biff8 the patch assumes incorrectly that xlsx is provided. It is not.
Just to summarize: Excel does not include the comment text in the biff8 target it provides via the clipboard. So this is clearly Excel bug.