lib/roo/excelx.rb in roo-2.3.2 vs lib/roo/excelx.rb in roo-2.4.0
- old
+ new
@@ -352,12 +352,14 @@
hash[id.value] = attributes['Target'].value
hash
end
end
+ # Extracts the sheets in order, but it will ignore sheets that are not
+ # worksheets.
def extract_sheets_in_order(entries, sheet_ids, sheets, tmpdir)
- sheet_ids.each_with_index do |id, i|
+ (sheet_ids & sheets.keys).each_with_index do |id, i|
name = sheets[id]
entry = entries.find { |e| e.name =~ /#{name}$/ }
path = "#{tmpdir}/roo_sheet#{i + 1}"
sheet_files << path
@sheet_files << path
@@ -412,9 +414,13 @@
# In some situations, this isn't true. The true location of a
# sheet's comment file is in the sheet1.xml.rels file. SEE
# ECMA-376 12.3.3 in "Ecma Office Open XML Part 1".
nr = Regexp.last_match[1].to_i
comments_files[nr - 1] = "#{@tmpdir}/roo_comments#{nr}"
+ when %r{chartsheets/_rels/sheet([0-9]+).xml.rels$}
+ # NOTE: Chart sheet relationship files were interfering with
+ # worksheets.
+ nil
when /sheet([0-9]+).xml.rels$/
# FIXME: Roo seems to use sheet[\d].xml.rels for hyperlinks only, but
# it also stores the location for sharedStrings, comments,
# drawings, etc.
nr = Regexp.last_match[1].to_i