Sha256: 44a355d0c9bce60302b522d8520eb5b929b8ef8c3f14067eced22b9552acd733

Contents?: true

Size: 945 Bytes

Versions: 4

Compression:

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

4 entries across 4 versions & 2 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/caxlsx-4.1.0/lib/axlsx/workbook/worksheet/row_breaks.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/caxlsx-4.1.0/lib/axlsx/workbook/worksheet/row_breaks.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/caxlsx-4.1.0/lib/axlsx/workbook/worksheet/row_breaks.rb
caxlsx-4.1.0 lib/axlsx/workbook/worksheet/row_breaks.rb