diff options
Diffstat (limited to 'lib/roo/excelx/sheet_doc.rb')
| -rwxr-xr-x | lib/roo/excelx/sheet_doc.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/roo/excelx/sheet_doc.rb b/lib/roo/excelx/sheet_doc.rb index 6da4c26..adbb77a 100755 --- a/lib/roo/excelx/sheet_doc.rb +++ b/lib/roo/excelx/sheet_doc.rb @@ -101,12 +101,7 @@ module Roo cell_xml_children.each do |cell| case cell.name when 'is' - content = +"" - cell.children.each do |inline_str| - if inline_str.name == 't' - content << inline_str.content - end - end + content = cell.search('t').map(&:content).join unless content.empty? return Excelx::Cell.cell_class(:string).new(content, formula, style, hyperlink, coordinate) end @@ -197,11 +192,12 @@ module Roo # Extract merged ranges from xml merges = {} doc.xpath('/worksheet/mergeCells/mergeCell').each do |mergecell_xml| - tl, br = mergecell_xml["ref"].split(/:/).map { |ref| ::Roo::Utils.ref_to_key(ref) } - for row in tl[0]..br[0] do - for col in tl[1]..br[1] do - next if row == tl[0] && col == tl[1] - merges[[row, col]] = tl + src, dst = mergecell_xml["ref"].split(/:/).map { |ref| ::Roo::Utils.ref_to_key(ref) } + next unless cells[src] + for row in src[0]..dst[0] do + for col in src[1]..dst[1] do + next if row == src[0] && col == src[1] + merges[[row, col]] = src end end end |
