Sha256: d34ea9d363b038fd60dc0cb3164c166cf72c6d3a0bd936bd4e88b3f45c6f2360

Contents?: true

Size: 944 Bytes

Versions: 1

Compression:

Stored size: 944 Bytes

Contents

# frozen_string_literal: true

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="' << size.to_s << '" manualBreakCount="' << 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-4.0.0 lib/axlsx/workbook/worksheet/row_breaks.rb