Sha256: 85ff122e2738353af0d9e4020f810f7021427f79ba64e38a45607b197d3804c3

Contents?: true

Size: 963 Bytes

Versions: 1

Compression:

Stored size: 963 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

1 entries across 1 versions & 1 rubygems

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