Sha256: bdd5320054516700176a34533684aa5dcc3d9290e10689b6139c37185c6bdcff

Contents?: true

Size: 930 Bytes

Versions: 2

Compression:

Stored size: 930 Bytes

Contents

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

    # Adds a row break
    # @param [Hash] options The options for the break to be created.
    # max and man values are fixed.
    # @see Break
    def add_break(options)
      # force feed the excel default
      self << Break.new(options.merge(:max => 16383, :man => true))
      last
    end

    # <rowBreaks count="3" manualBreakCount="3">
    # <brk id="1" max="16383" man="1"/>
    # <brk id="7" max="16383" man="1"/>
    # <brk id="13" max="16383" man="1"/>
    # </rowBreaks>
    def to_xml_string(str = '')
      return if empty?

      str << ('<rowBreaks count="' << self.size.to_s << '" manualBreakCount="' << self.size.to_s << '">')
      each { |brk| brk.to_xml_string(str) }
      str << '</rowBreaks>'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
caxlsx-3.4.1 lib/axlsx/workbook/worksheet/row_breaks.rb
caxlsx-3.4.0 lib/axlsx/workbook/worksheet/row_breaks.rb