Class: Writexlsx::Worksheet::DynamicFormulaArrayCellData

Inherits:
CellData
  • Object
show all
Defined in:
lib/write_xlsx/worksheet/cell_data.rb

Overview

:nodoc:

Constant Summary

Constants included from Constants

Constants::COL_MAX, Constants::ROW_MAX, Constants::SHEETNAME_MAX, Constants::STR_MAX

Constants included from Utility::Common

Utility::Common::PERL_TRUE_VALUES

Instance Attribute Summary collapse

Attributes inherited from CellData

#xf

Instance Method Summary collapse

Methods inherited from CellData

#cell_attributes, #display_url_string?

Methods included from Utility::CellReference

#row_col_notation, #substitute_cellref, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell

Methods included from Utility::Common

#absolute_char, #check_parameter, #float_to_str, #ptrue?, #put_deprecate_message

Constructor Details

#initialize(formula, xf, range, result) ⇒ DynamicFormulaArrayCellData

Returns a new instance of DynamicFormulaArrayCellData.



158
159
160
161
162
163
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 158

def initialize(formula, xf, range, result)
  @token = formula
  @xf = xf
  @range = range
  @result = result
end

Instance Attribute Details

Returns the value of attribute link_type.



156
157
158
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 156

def link_type
  @link_type
end

#rangeObject (readonly)

Returns the value of attribute range.



156
157
158
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 156

def range
  @range
end

#resultObject (readonly)

Returns the value of attribute result.



156
157
158
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 156

def result
  @result
end

#tokenObject (readonly)

Returns the value of attribute token.



156
157
158
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 156

def token
  @token
end

#urlObject (readonly)

Returns the value of attribute url.



156
157
158
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 156

def url
  @url
end

Instance Method Details

#dataObject



165
166
167
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 165

def data
  @result || 0
end

#write_cell(worksheet, row, row_name, col) ⇒ Object



169
170
171
172
173
174
175
176
177
178
# File 'lib/write_xlsx/worksheet/cell_data.rb', line 169

def write_cell(worksheet, row, row_name, col)
  # Add metadata linkage for dynamic array formulas.
  attributes = cell_attributes(worksheet, row, row_name, col)
  attributes << %w[cm 1]

  worksheet.writer.tag_elements('c', attributes) do
    worksheet.write_cell_array_formula(token, range)
    worksheet.write_cell_value(result)
  end
end