class ChupaText::Decomposers::OfficeOpenXMLWorkbook::SheetListener
Constants
- URI
Public Class Methods
Source
# File lib/chupa-text/decomposers/office-open-xml-workbook.rb, line 119 def initialize(sheet) @sheet = sheet @cell_type = nil @in_is = false # inline string @in_v = false # value end
Public Instance Methods
Source
# File lib/chupa-text/decomposers/office-open-xml-workbook.rb, line 156 def cdata(content) add_column(content) end
Source
# File lib/chupa-text/decomposers/office-open-xml-workbook.rb, line 152 def characters(text) add_column(text) end
Source
# File lib/chupa-text/decomposers/office-open-xml-workbook.rb, line 140 def end_element(uri, local_name, qname) return unless uri == URI case local_name when "c" @cell_type = nil when "is" @in_is = false when "v" @in_v = false end end
Source
# File lib/chupa-text/decomposers/office-open-xml-workbook.rb, line 126 def start_element(uri, local_name, qname, attributes) return unless uri == URI case local_name when "row" @sheet << [] when "c" @cell_type = parse_cell_type(attributes["t"]) when "is" @in_is = true when "v" @in_v = true end end
Private Instance Methods
Source
# File lib/chupa-text/decomposers/office-open-xml-workbook.rb, line 187 def add_column(text) return unless have_text? case @cell_type when :shared_string @sheet.last << Integer(text, 10) else @sheet.last << text end end
Source
# File lib/chupa-text/decomposers/office-open-xml-workbook.rb, line 181 def have_text? return true if @in_is return true if @in_v false end
Source
# File lib/chupa-text/decomposers/office-open-xml-workbook.rb, line 162 def parse_cell_type(type) case type when "b" :boolean when "e" :error when "inlineStr" :inline_string when "n" :number when "s" :shared_string when "str" :string else nil end end
c-rex.net/projects/samples/ooxml/e1/Part4/OOXML_P4_DOCX_ST_CellType_topic_ID0E6NEFB.html