Class: Axlsx::RowBreaks

Inherits:
SimpleTypedList
  • Object
show all
Defined in:
lib/axlsx/workbook/worksheet/row_breaks.rb

Overview

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

Instance Method Summary collapse

Constructor Details

#initializeRowBreaks

Returns a new instance of RowBreaks.


7
8
9
# File 'lib/axlsx/workbook/worksheet/row_breaks.rb', line 7

def initialize
  super Break
end

Instance Method Details

#add_break(options) ⇒ Object

Adds a row break max and man values are fixed.

Parameters:

  • options (Hash)

    The options for the break to be created.

See Also:


15
16
17
18
19
# File 'lib/axlsx/workbook/worksheet/row_breaks.rb', line 15

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

#to_xml_string(str = '') ⇒ Object


26
27
28
29
30
31
# File 'lib/axlsx/workbook/worksheet/row_breaks.rb', line 26

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