summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/workbook/worksheet/row_breaks.rb
blob: b8158a897b8bcaad61c1ba3cfc9e15c01b1f5965 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module Axlsx

  # A collection of break objects that define row breaks (page breaks) for printing and preview

  class RowBreaks < SimpleTypedList

    def initialize
      super Break
    end

    def add_break(options)
      # force feed the excel default
      options.merge max: 16383, man: true
      @list << Break.new(options)
      last
    end

    def to_xml_string(str='')
      return if empty?
      str << '<rowBreaks count="' << @list.size << '" manualBreakCount="' << @list.size << '">'
      each { |brk| brk.to_xml_string(str) }
      str << '</rowBreaks>'
    end
  end
end