lib/roo/openoffice.rb in roo-0.9.1 vs lib/roo/openoffice.rb in roo-0.9.2
- old
+ new
@@ -277,10 +277,13 @@
@cell[sheet][key] = str_v
when :date
@cell[sheet][key] = tr.attributes['date-value']
when :percentage
@cell[sheet][key] = v.to_f
+ when :time
+ hms = v.split(':')
+ @cell[sheet][key] = hms[0].to_i*3600 + hms[1].to_i*60 + hms[2].to_i
else
@cell[sheet][key] = v
end
end
@@ -343,10 +346,17 @@
str_v.gsub!(/&/,'&')
str_v.gsub!(/'/,"'")
end # == 'p'
end
end
+ if vt == 'time'
+ tr.each_element do |str|
+ if str.name == 'p'
+ v = str.text
+ end
+ end
+ end
if skip
if v != nil or tr.attributes['date-value']
0.upto(skip.to_i-1) do |i|
set_cell_values(sheet,x,y,i,v,vt,formula,tr,str_v)
end
@@ -440,9 +450,10 @@
A_ROO_TYPE = {
"float" => :float,
"string" => :string,
"date" => :date,
"percentage" => :percentage,
+ "time" => :time,
}
def Openoffice.oo_type_2_roo_type(ootype)
return A_ROO_TYPE[ootype]
end