class OoxmlParser::Formula

Class for parsing `formulas` <f>

Attributes

reference[R]

@return [Coordinates] reference coordinates

string_index[R]

@return [StringIndex] string index

type[R]

@return [String] type

value[R]

@return [String] value

Public Instance Methods

empty?() click to toggle source

@return [True, False] check if formula empty

# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb, line 35
def empty?
  !(reference || string_index || type || value)
end
parse(node) click to toggle source

Parse Formula object @param node [Nokogiri::XML:Element] node to parse @return [Formula] parsed object

# File lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/worksheet/xlsx_row/xlsx_cell/formula.rb, line 18
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'ref'
      @reference = Coordinates.parser_coordinates_range(value.value.to_s)
    when 'si'
      @string_index = value.value.to_i
    when 't'
      @type = value.value.to_s
    end
  end

  @value = node.text unless node.text.empty?
  self
end