Method: Axlsx::Row#initialize

Defined in:
lib/axlsx/workbook/worksheet/row.rb

#initialize(worksheet, values = [], options = {}) ⇒ Row

Creates a new row. New Cell objects are created based on the values, types and style options. A new cell is created for each item in the values array. style and types options are applied as follows: If the types option is defined and is a symbol it is applied to all the cells created. If the types option is an array, cell types are applied by index for each cell If the types option is not set, the cell will automatically determine its type. If the style option is defined and is an Integer, it is applied to all cells created. If the style option is an array, style is applied by index for each cell. If the style option is not defined, the default style (0) is applied to each cell.

Parameters:

  • worksheet (Worksheet)
  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • values (Array)
  • types (Array, Symbol)
  • style (Array, Integer)
  • escape_formulas (Array, Boolean)
  • height (Float)

    the row's height (in points)

  • offset (Integer)
    • add empty columns before values

See Also:

  • #array_to_cells
  • Cell


33
34
35
36
37
38
39
# File 'lib/axlsx/workbook/worksheet/row.rb', line 33

def initialize(worksheet, values = [], options = {})
  self.worksheet = worksheet
  super(Cell, nil, values.size + options[:offset].to_i)
  self.height = options.delete(:height)
  worksheet.rows << self
  array_to_cells(values, options)
end