class OoxmlParser::SharedStringTable
Class for parsing shared string table
Attributes
@return [Integer] count of shared strings
@return [Array<StringIndex>] String Index
@return [Integer] unique count of shared strings
Public Class Methods
Source
# File lib/ooxml_parser/xlsx_parser/workbook/shared_string_table.rb, line 14 def initialize(parent: nil) @string_indexes = [] super end
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
Public Instance Methods
Source
# File lib/ooxml_parser/xlsx_parser/workbook/shared_string_table.rb, line 22 def parse(file) return nil unless File.exist?(file) document = parse_xml(file) node = document.xpath('*').first node.attributes.each do |key, value| case key when 'count' @count = value.value.to_i when 'uniqueCount' @unique_count = value.value.to_i end end node.xpath('*').each do |node_child| case node_child.name when 'si' @string_indexes << StringIndex.new(parent: self).parse(node_child) end end self end
Parse Shared string table file @param file [String] path to file @return [SharedStringTable]