zdavatz / spreadsheet

The Ruby Spreadsheet by ywesee GmbH
http://spreadsheet.ch
GNU General Public License v3.0
1.13k stars 240 forks source link

Adjacent cells in a column using formulas have their data deleted #147

Closed endofhome closed 7 years ago

endofhome commented 9 years ago

I'm experiencing a problem where cells in a column have all their data deleted if two or more adjacent cells use formulas.

Here's the code:

require 'spreadsheet'
Spreadsheet.client_encoding = 'UTF-8'

def test

# open the spreadsheet
book = Spreadsheet.open 'test.xls'
sheet1 = book.worksheet 0

# the new data
a = 1
b = 2

# input the new data into the spreadsheet
sheet1[5, 1] = a
sheet1[5, 2] = b

# save to "-Modded" file in same folder. 
book.write 'test-Modded.xls'
end

test

The original file looks like this: 1-before

The result I want is this: 2-after-desired

but the actual result is this: 3-after-actual

test files, including an XLS file: https://www.dropbox.com/s/qblq7mcfy6cvc48/delete_error.zip?dl=0

endofhome commented 9 years ago

I should add that I'm using LibreOffice 4.4.4.3 to create and open the .XLS file. I don't have Excel on my system.

zdavatz commented 9 years ago

Ok, this looks like a bug. I will test and get back to you.

zdavatz commented 9 years ago

I get this, so I guess this is a bug. What Ruby Version are you using? modded

zdavatz commented 9 years ago

sorry, uploaded wrong screen.

endofhome commented 9 years ago

OK. Note the behaviour when the formula in D7 is moved down to D8 and D7 has no formula in it - everything then works as it should. The problem only appears when there are two adjacent formulas in a column.