lib/roo/openoffice.rb in roo-0.6.0 vs lib/roo/openoffice.rb in roo-0.6.1
- old
+ new
@@ -423,20 +423,21 @@
end
def belegen(x,y,i,v,vt,formula,tr,str_v)
@cell_type["#{y},#{x+i}"] = Openoffice.oo_type_2_roo_type(vt)
@formula["#{y},#{x+i}"] = formula if formula
- if @cell_type["#{y},#{x+i}"] == :float
+ case @cell_type["#{y},#{x+i}"]
+ when :float
@cell["#{y},#{x+i}"] = v.to_f
- elsif @cell_type["#{y},#{x+i}"] == :string
+ when :string
@cell["#{y},#{x+i}"] = str_v
- elsif @cell_type["#{y},#{x}"] == :date
- @cell["#{y},#{x}"] = tr.attributes['date-value']
- elsif @cell_type["#{y},#{x+i}"] == :percentage
- @cell["#{y},#{x+i}"] = v
+ when :date
+ @cell["#{y},#{x+i}"] = tr.attributes['date-value']
+ when :percentage
+ @cell["#{y},#{x+i}"] = v.to_f
else
- @cell["#{y},#{x}"] = v
+ @cell["#{y},#{x+i}"] = v
end
end
# read all cells in the selected sheet
#--
@@ -497,10 +498,10 @@
str_v.gsub!(/'/,"'")
end # == 'p'
end
end
if skip
- if v != nil
+ if v != nil or tr.attributes['date-value']
0.upto(skip.to_i-1) do |i|
belegen(x,y,i,v,vt,formula,tr,str_v)
end
end
x += (skip.to_i - 1)