Bugs: Browse | Submit New | Admin

[#27110] workbook save failed

Date:
2009-09-16 03:20
Priority:
3
Submitted By:
John Lee (freebuilder)
Assigned To:
Nobody (None)
Category:
workbook
State:
Closed
Summary:
workbook save failed

Detailed description
I got a exception When I use this gem and save a excel file. The error messages is --

"You have a nil object when you didn't expect it!\nYou might have expected an instance of Array.\nThe error occurred
while evaluating nil.<=>"
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.<=>
/home/john/software/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/spreadsheet-0.6.4/lib/spreadsheet/excel/writer/worksheet.rb:275:in
`<=>'
/home/john/software/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/spreadsheet-0.6.4/lib/spreadsheet/excel/writer/worksheet.rb:275:in
`sort_by'
/home/john/software/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/spreadsheet-0.6.4/lib/spreadsheet/excel/writer/worksheet.rb:275:in
`write_changes'
/home/john/software/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/spreadsheet-0.6.4/lib/spreadsheet/excel/writer/workbook.rb:176:in
`write_changes'
/home/john/software/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/spreadsheet-0.6.4/lib/spreadsheet/excel/writer/workbook.rb:171:in
`each'
/home/john/software/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/spreadsheet-0.6.4/lib/spreadsheet/excel/writer/workbook.rb:171:in
`write_changes'
/home/john/software/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/spreadsheet-0.6.4/lib/spreadsheet/excel/writer/workbook.rb:626:in
`write_workbook'
/home/john/software/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/spreadsheet-0.6.4/lib/spreadsheet/writer.rb:15:in `write'
/home/john/software/ruby-1.8.7-p72/lib/ruby/gems/1.8/gems/spreadsheet-0.6.4/lib/spreadsheet/writer.rb:14:in `open'

solution: 
edit this file:
gems/spreadsheet-0.6.4/lib/spreadsheet/excel/writer/worksheet.rb
change the line 272 to:

        work.store key, pair unless pair.nil?

then the save operation is ok.

Add A Comment: Notepad

Please login


Followup

Message
Date: 2009-09-17 14:46
Sender: Hannes Wyss

Released in 0.6.4.1
Date: 2009-09-16 12:42
Sender: Hannes Wyss

Aha! The worksheet was being modified during the writing process.

Fixed in http://scm.ywesee.com/?p=spreadsheet;a=commit;h=72c65959
f906a1d19421375a3cd0b96f7280dc13
queued for inclusion in 0.6.4.1
Date: 2009-09-16 09:49
Sender: Hannes Wyss

Excellent, thanks!
Date: 2009-09-16 09:43
Sender: John Lee

It's not from the real world. You can include it in the
repository
Date: 2009-09-16 09:35
Sender: Hannes Wyss

Thanks!

The data in the file looks kind of private - can I include this
in the repository as ./test/data/test_changes.xls?

Date: 2009-09-16 09:19
Sender: John Lee

HI, the sample file is attached. 
Date: 2009-09-16 06:16
Sender: Hannes Wyss

Hi John!

You're obviously trying to modify an existing Excel file.  Could
you upload an example file and minimal code that reproduces the
problem?

Thanks in advance, 
cheers
Hannes

Attached Files:

Name Description Download
licenses.xls sample file Download

Changes:

Field Old Value Date By
status_idOpen2009-09-17 14:46hwyss
resolution_idNone2009-09-17 14:46hwyss
close_date2009-09-17 14:462009-09-17 14:46hwyss
File Added4724: licenses.xls2009-09-16 09:19freebuilder