lib/roo/excelx.rb in roo-1.9.3 vs lib/roo/excelx.rb in roo-1.9.4

- old
+ new

@@ -46,10 +46,11 @@ #-- zusaetzliche Formate, die nicht standardmaessig definiert sind: "yyyy\\-mm\\-dd" => :date, 'dd/mm/yy' => :date, 'hh:mm:ss' => :time, "dd/mm/yy\\ hh:mm" => :datetime, + 'dd/mmm/yy' => :date, # 2011-05-21 } STANDARD_FORMATS = { 0 => 'General', 1 => '0', 2 => '0.00', @@ -414,16 +415,20 @@ if c['t'] == 's' tmp_type = :shared #TODO: elsif (c.attributes.to_h['t'] == 'b') elsif c['t'] == 'b' tmp_type = :boolean + # 2011-02-25 BEGIN + elsif c['t'] == 'str' + tmp_type = :string + # 2011-02-25 END else - #s_attribute = c.attributes.to_h['s'].to_i # was here + #s_attribute = c.attributes.to_h['s'].to_i # was here s_attribute = c['s'].to_i # was here - format = attribute2format(s_attribute) - tmp_type = format2type(format) - end + format = attribute2format(s_attribute) + tmp_type = format2type(format) + end formula = nil #TODO: c.each_element do |cell| c.children.each do |cell| #TODO: if cell.name == 'f' if cell.name == 'f' @@ -460,10 +465,16 @@ vt = :datetime v = cell.content elsif tmp_type == :formula vt = :formula v = cell.content.to_f #TODO: !!!! + # 2011-02-25 BEGIN + elsif tmp_type == :string + vt = :string + str_v = cell.content + excelx_type = :string + # 2011-02-25 END else vt = :float v = cell.content end #puts "vt: #{vt}" if cell.text.include? "22606.5120" @@ -607,10 +618,10 @@ #TODO: doc.find("//*[local-name()='cellXfs']").each do |xfs| doc.xpath("//*[local-name()='cellXfs']").each do |xfs| xfs.children.each do |xf| #TODO: numFmtId = xf.attributes.to_h['numFmtId'] - numFmtId = xf['numFmtId'] + numFmtId = xf['numFmtId'] @cellXfs << [numFmtId] #TODO: fontId = xf.attributes.to_h['fontId'].to_i fontId = xf['fontId'].to_i @style_definitions << fonts[fontId] end