class RubyXL::ColumnRanges
def before_write_xml
def before_write_xml !(column_ranges.nil? || column_ranges.empty?) end
def find(col_index)
def find(col_index) column_ranges && column_ranges.find { |range| range.include?(col_index) } end
def get_range(col_index)
Locate an existing column range, make a new one if not found,
def get_range(col_index) col_num = col_index + 1 old_range = self.find(col_index) if old_range.nil? then new_range = RubyXL::ColumnRange.new(:min => col_num, :max => col_num) self.column_ranges << new_range return new_range elsif old_range.min == col_num && old_range.max == col_num then # Single column range, OK to change in place return old_range else raise "Range splitting not implemented yet" end end
def insert_column(col_index)
def insert_column(col_index) column_ranges && column_ranges.each { |range| range.insert_column(col_index) } end