class Axlsx::ColBreaks

A collection of Brake objects. Please do not use this class directly. Instead use Worksheet#add_break

Public Class Methods

new() click to toggle source

Instantiates a new list restricted to Break types

Calls superclass method Axlsx::SimpleTypedList::new
# File lib/axlsx/workbook/worksheet/col_breaks.rb, line 9
def initialize
  super Break
end

Public Instance Methods

add_break(options) click to toggle source

A column break specific helper for adding a break. @param [Hash] options A list of options to pass into the Break object The max and man options are fixed, however any other valid option for Break will be passed to the created break object. @see Break

# File lib/axlsx/workbook/worksheet/col_breaks.rb, line 18
def add_break(options)
  @list << Break.new(options.merge(:max => 1048575, :man => true))
  last
end
to_xml_string(str='') click to toggle source

Serialize the collection to xml @param [String] str The string to append this lists xml to. <colBreaks count=“1” manualBreakCount=“1”> <brk id=“3” max=“1048575” man=“1”/> </colBreaks>

# File lib/axlsx/workbook/worksheet/col_breaks.rb, line 28
def to_xml_string(str='')
  return if empty?
  str << '<colBreaks count="' << @list.size.to_s << '" manualBreakCount="' << @list.size.to_s << '">'
  each { |brk| brk.to_xml_string(str) }
  str << '</colBreaks>'
end