Method: RubyXL::WorkbookConvenienceMethods#register_new_xf

Defined in:
lib/rubyXL/convenience_methods/workbook.rb

#register_new_xf(new_xf) ⇒ Object



45
46
47
48
49
50
# File 'lib/rubyXL/convenience_methods/workbook.rb', line 45

def register_new_xf(new_xf)
  new_xf_id = cell_xfs.find_index { |xf| xf == new_xf } # Reuse existing XF, if it exists
  new_xf_id ||= cell_xfs.size # If this XF has never existed before, add it to collection.
  cell_xfs[new_xf_id] = new_xf
  new_xf_id
end