diff options
Diffstat (limited to 'lib/roo/excelx.rb')
| -rwxr-xr-x | lib/roo/excelx.rb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/roo/excelx.rb b/lib/roo/excelx.rb index f9f0ee2..91ebc1e 100755 --- a/lib/roo/excelx.rb +++ b/lib/roo/excelx.rb @@ -60,15 +60,16 @@ module Roo @filename = local_filename(filename_or_stream, @tmpdir, packed) process_zipfile(@filename || filename_or_stream) - @sheet_names = workbook.sheets.map do |sheet| - unless options[:only_visible_sheets] && sheet['state'] == 'hidden' - sheet['name'] - end - end.compact + @sheet_names = [] @sheets = [] @sheets_by_name = {} - @sheet_names.each_with_index do |sheet_name, n| - @sheets_by_name[sheet_name] = @sheets[n] = Sheet.new(sheet_name, @shared, n, sheet_options) + + workbook.sheets.each_with_index do |sheet, index| + next if options[:only_visible_sheets] && sheet['state'] == 'hidden' + + sheet_name = sheet['name'] + @sheet_names << sheet_name + @sheets_by_name[sheet_name] = @sheets[index] = Sheet.new(sheet_name, @shared, index, sheet_options) end if cell_max @@ -428,6 +429,11 @@ module Roo entries.each do |entry| path = case entry.name.downcase + when /richdata/ + # FIXME: Ignore richData as parsing is not implemented yet and can cause + # Zip::DestinationFileExistsError when including a second "styles.xml" entry + # see http://schemas.microsoft.com/office/spreadsheetml/2017/richdata2 + nil when /sharedstrings.xml$/ "#{@tmpdir}/roo_sharedStrings.xml" when /styles.xml$/ |
