Class: Writeexcel::Worksheet::FilterRange

Inherits:
CellRange
  • Object
show all
Defined in:
lib/writeexcel/cell_range.rb

Instance Attribute Summary

Attributes inherited from CellRange

#col_max, #col_min, #row_max, #row_min

Instance Method Summary collapse

Methods inherited from CellRange

#col, #increment_col_max, #increment_row_max, #initialize, #name_record_long, #row

Constructor Details

This class inherits a constructor from Writeexcel::Worksheet::CellRange

Instance Method Details

#countObject


196
197
198
199
200
201
202
# File 'lib/writeexcel/cell_range.rb', line 196

def count
  if @col_min && @col_max
    1 + @col_max - @col_min
  else
    0
  end
end

#inside?(col) ⇒ Boolean


204
205
206
# File 'lib/writeexcel/cell_range.rb', line 204

def inside?(col)
  @col_min <= col && col <= @col_max
end

#name_record_short(ext_ref, hidden) ⇒ Object


192
193
194
# File 'lib/writeexcel/cell_range.rb', line 192

def name_record_short(ext_ref, hidden)
  super(0x0D, ext_ref, hidden) # 0x0D  NAME type = Filter Database
end

#storeObject


208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# File 'lib/writeexcel/cell_range.rb', line 208

def store
  record          = 0x00EC           # Record identifier

  spid            = @worksheet.object_ids.spid

  # Number of objects written so far.
  num_objects     = @worksheet.images_size + @worksheet.charts_size

  (0 .. count-1).each do |i|
    if i == 0 && num_objects
      spid, data = write_parent_msodrawing_record(count, @worksheet.comments_size, spid, vertices(i))
    else
      spid, data = write_child_msodrawing_record(spid, vertices(i))
    end
    length      = data.bytesize
    header      = [record, length].pack("vv")
    append(header, data)

    store_obj_filter(num_objects + i + 1, col_min + i)
  end
  spid
end