class Oxcelix::Styles

Ox based SAX parser which pushes the number formats (taken from the styles.xml file) to an array The reference taken from the cell's 's' attribute points to an element of the style array, which in turn points to a number format (numFmt) that can be either built-in (@formats) or defined in the styles.xml itself.

Attributes

styleary[RW]
temparray[RW]
xmlstack[RW]

Public Class Methods

new() click to toggle source
# File lib/oxcelix/sax/styles.rb, line 10
def initialize
  @temparray = []
  @styleary  = []
  @xmlstack  = []
  @numform   = {}
end

Public Instance Methods

attr(name, str) click to toggle source
# File lib/oxcelix/sax/styles.rb, line 45
def attr(name, str)
  self.send name, str if self.respond_to?(name)
end
end_element(name) click to toggle source
# File lib/oxcelix/sax/styles.rb, line 41
def end_element(name)
  @xmlstack.pop
end
formatCode(str) click to toggle source
# File lib/oxcelix/sax/styles.rb, line 33
def formatCode str
  nf :formatCode, str
end
nf(key, value) click to toggle source
# File lib/oxcelix/sax/styles.rb, line 17
def nf key, value
  @numform[key]=value
  if @numform.size == 2
    @temparray << @numform
    @numform = {}
  end
end
numFmtId(str) click to toggle source
# File lib/oxcelix/sax/styles.rb, line 25
def numFmtId str
  if @xmlstack[-2] == :cellXfs
    @styleary << str
  elsif @xmlstack[-2] == :numFmts
    nf :numFmtId, str
  end
end
start_element(name) click to toggle source
# File lib/oxcelix/sax/styles.rb, line 37
def start_element(name)
  @xmlstack << name
end