Method: Axlsx::AutoFilter#apply

Defined in:
lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb

#applyObject

actually performs the filtering of rows who's cells do not match the filter.



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/axlsx/workbook/worksheet/auto_filter/auto_filter.rb', line 52

def apply
  first_cell, last_cell = range.split(':')
  start_point = Axlsx::name_to_indices(first_cell)
  end_point = Axlsx::name_to_indices(last_cell)
  # The +1 is so we skip the header row with the filter drop downs
  rows = worksheet.rows[(start_point.last+1)..end_point.last] || []

  column_offset = start_point.first
  columns.each do |column|
    rows.each do |row|
      next if row.hidden
      column.apply(row, column_offset)
    end
  end
end