class OoxmlParser::TableStyles
Class for parsing ‘tableStyles.xml` file
Attributes
@return [Array<TableStyle>] list of table styles
Public Class Methods
Source
# File lib/ooxml_parser/pptx_parser/presentation/table_styles.rb, line 9 def initialize(parent: nil) @table_style_list = [] super end
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
Public Instance Methods
Source
# File lib/ooxml_parser/pptx_parser/presentation/table_styles.rb, line 17 def parse(file = "#{root_object.unpacked_folder}/#{root_object.root_subfolder}/tableStyles.xml") return nil unless File.exist?(file) document = parse_xml(file) node = document.xpath('*').first node.xpath('*').each do |node_child| case node_child.name when 'tblStyle' @table_style_list << TableStyle.new(parent: self).parse(node_child) end end self end
Parse TableStyles
object @param file [Nokogiri::XML:Element] node to parse @return [TableStyles] result of parsing
Source
# File lib/ooxml_parser/pptx_parser/presentation/table_styles.rb, line 34 def style_by_id(id) table_style_list.detect { |style| style.id == id } end
@param id [String] style to find @return [TableStyle] style by this id