From ce4be347862e415c32cc2eaab8aebb322d52ba3b Mon Sep 17 00:00:00 2001 From: Jeremy Aube Date: Thu, 23 Apr 2020 17:03:27 -0400 Subject: [PATCH 1/3] Fixes issue where the contents of hidden sheet was returned when parsing visible sheets only. --- lib/roo/excelx.rb | 7 +++++-- spec/lib/roo/excelx_spec.rb | 10 +++++++++- test/.DS_Store | Bin 0 -> 8196 bytes test/files/hidden_sheets.xlsx | Bin 6152 -> 10296 bytes 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 test/.DS_Store diff --git a/lib/roo/excelx.rb b/lib/roo/excelx.rb index f9f0ee26..25194614 100755 --- a/lib/roo/excelx.rb +++ b/lib/roo/excelx.rb @@ -60,15 +60,18 @@ def initialize(filename_or_stream, options = {}) @filename = local_filename(filename_or_stream, @tmpdir, packed) process_zipfile(@filename || filename_or_stream) - @sheet_names = workbook.sheets.map do |sheet| + sheet_indicies = [] + @sheet_names = workbook.sheets.each_with_index.map do |sheet, index| unless options[:only_visible_sheets] && sheet['state'] == 'hidden' + sheet_indicies << index sheet['name'] end end.compact @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) + sheet_index = sheet_indicies[n] + @sheets_by_name[sheet_name] = @sheets[sheet_index] = Sheet.new(sheet_name, @shared, sheet_index, sheet_options) end if cell_max diff --git a/spec/lib/roo/excelx_spec.rb b/spec/lib/roo/excelx_spec.rb index 1b67a4db..7cc9b13e 100755 --- a/spec/lib/roo/excelx_spec.rb +++ b/spec/lib/roo/excelx_spec.rb @@ -86,6 +86,14 @@ end end + describe 'for a workbook with hidden sheets' do + let(:path) { 'test/files/hidden_sheets.xlsx' } + + it 'returns the cell contents from the visible sheet' do + expect(Roo::Excelx.new(path, only_visible_sheets: true).cell('A', 1)).to eq "visible sheet 1" + end + end + describe '#parse' do let(:path) { 'test/files/numeric-link.xlsx' } @@ -653,4 +661,4 @@ end end end -end \ No newline at end of file +end diff --git a/test/.DS_Store b/test/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..e96db6ad84257d06adf55e118f1a12155a054028 GIT binary patch literal 8196 zcmeHMTWl0n7(QPqFhhqj1(dQbxKN;=HM9jmL}BR`1Sz(%EiF)4W_JddFrBG0vstQ6t51dL<&HXrvRc* zoALnRlZs?Il0#AoSBfdK2Sl!jQVd9U(xCpIo9zwfBd%=LVZBKOmXYCj~V5bp_Au@GY+IE_hC{ z&kb^VO~G&qMTZbt;Tp|vOEx>2g0ErI8U84;|JR#76RK1?H#t|cMb4W+iU~{ z%QbCxXLrdC?7U-jx<;R+pI24kR69M9=qcvy2a9&NSFckP(K};iLhChYpbehMgPHnq zMcU7vnMiEqnv8EzZAK3B>JwULKr_;f$ne$%P3zoEYpw^;P>oGmqRTPzmZO`h9Ow2W zTB5roLDknsop&zR58Unz-73@M z&qO?WrdO6#I;Q z&Cao3*m-t={l!6FzQh@v#X04 zlEXP2eWI&)_41rf-or_K4RiY2YDwf9Zk(2yyWqCwrFX5m$b=DVKa8H2GE&e`@=Wlr z%rCL-XNm7OC1+?imv_U+UD8F2we~2ScKUc}Jv%u^A*ShyxYg>DRVr-WJA1k%XwB;)81-(*gS7>R4D6fx`+KjeZrA?``e~Y@GvNP-l zqV1nx7>6oMK`mxs0TyBz5jBkrTCqlubtAIq!nTO8yNR%U@URDaF^Grp2$A-2LD~a& z4$tF79K_2wj3ampZxelw;W$p@BqeF6{O2D6qFvpaHM|0Du(WWtDAM$4u6WLoW3;&yOYAlMx2?Kzakj5?IH)v*ULRSt-!=ELRum}B55r%* z^d7KP4_45ijH;He;2^<|VPX!RsD=4fJa5pxkMo#;qBcGHW^*{8Aax)}Ow0p`ZOxb~ znGGdC=R_=FSge92rW6_rr7cuYu823hY14=^W7}m{Kqy5FN)sPEIX}dRPp@t7i4^LD{&N# zdJw=eq}9e4eKfvJtwF#(2ef2(HH6p9alwEtyKY%Uw~*Q4H6&%NTIq8##WBZOh3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7a19d267b98b466a7afe78 Mon Sep 17 00:00:00 2001 From: Jeremy Aube Date: Tue, 4 Aug 2020 15:05:44 -0400 Subject: [PATCH 2/3] Deletes unnecessary file. --- test/.DS_Store | Bin 8196 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test/.DS_Store diff --git a/test/.DS_Store b/test/.DS_Store deleted file mode 100644 index e96db6ad84257d06adf55e118f1a12155a054028..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMTWl0n7(QPqFhhqj1(dQbxKN;=HM9jmL}BR`1Sz(%EiF)4W_JddFrBG0vstQ6t51dL<&HXrvRc* zoALnRlZs?Il0#AoSBfdK2Sl!jQVd9U(xCpIo9zwfBd%=LVZBKOmXYCj~V5bp_Au@GY+IE_hC{ z&kb^VO~G&qMTZbt;Tp|vOEx>2g0ErI8U84;|JR#76RK1?H#t|cMb4W+iU~{ z%QbCxXLrdC?7U-jx<;R+pI24kR69M9=qcvy2a9&NSFckP(K};iLhChYpbehMgPHnq zMcU7vnMiEqnv8EzZAK3B>JwULKr_;f$ne$%P3zoEYpw^;P>oGmqRTPzmZO`h9Ow2W zTB5roLDknsop&zR58Unz-73@M z&qO?WrdO6#I;Q z&Cao3*m-t={l!6FzQh@v#X04 zlEXP2eWI&)_41rf-or_K4RiY2YDwf9Zk(2yyWqCwrFX5m$b=DVKa8H2GE&e`@=Wlr z%rCL-XNm7OC1+?imv_U+UD8F2we~2ScKUc}Jv%u^A*ShyxYg>DRVr-WJA1k%XwB;)81-(*gS7>R4D6fx`+KjeZrA?``e~Y@GvNP-l zqV1nx7>6oMK`mxs0TyBz5jBkrTCqlubtAIq!nTO8yNR%U@URDaF^Grp2$A-2LD~a& z4$tF79K_2wj3ampZxelw;W$p@BqeF6{O2D6qF Date: Tue, 4 Aug 2020 15:19:13 -0400 Subject: [PATCH 3/3] Simplifies code for constructing excel sheet-related instance variables. --- lib/roo/excelx.rb | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/roo/excelx.rb b/lib/roo/excelx.rb index 25194614..83aa9e4b 100755 --- a/lib/roo/excelx.rb +++ b/lib/roo/excelx.rb @@ -60,18 +60,16 @@ def initialize(filename_or_stream, options = {}) @filename = local_filename(filename_or_stream, @tmpdir, packed) process_zipfile(@filename || filename_or_stream) - sheet_indicies = [] - @sheet_names = workbook.sheets.each_with_index.map do |sheet, index| - unless options[:only_visible_sheets] && sheet['state'] == 'hidden' - sheet_indicies << index - sheet['name'] - end - end.compact + @sheet_names = [] @sheets = [] @sheets_by_name = {} - @sheet_names.each_with_index do |sheet_name, n| - sheet_index = sheet_indicies[n] - @sheets_by_name[sheet_name] = @sheets[sheet_index] = Sheet.new(sheet_name, @shared, sheet_index, 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