Class: OoxmlParser::StyleSheet
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::StyleSheet
- Defined in:
- lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb
Overview
Parsing file styles.xml
Instance Attribute Summary collapse
-
#fills ⇒ Fills
Fills.
-
#fonts ⇒ Fonts
Fonts.
-
#number_formats ⇒ NumberFormats
Number formats.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ StyleSheet
constructor
A new instance of StyleSheet.
- #parse ⇒ Object
Methods inherited from OOXMLDocumentObject
#==, add_to_xmls_stack, copy_file_and_rename_to_zip, current_xml, dir, encrypted_file?, get_link_from_rels, unzip_file, #with_data?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ StyleSheet
Returns a new instance of StyleSheet.
14 15 16 17 18 19 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb', line 14 def initialize(parent: nil) @number_formats = NumberFormats.new(parent: self) @fonts = Fonts.new(parent: self) @fills = Fills.new(parent: self) @parent = parent end |
Instance Attribute Details
#fills ⇒ Fills
Returns fills.
12 13 14 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb', line 12 def fills @fills end |
#fonts ⇒ Fonts
Returns fonts.
10 11 12 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb', line 10 def fonts @fonts end |
#number_formats ⇒ NumberFormats
Returns number formats.
8 9 10 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb', line 8 def number_formats @number_formats end |
Instance Method Details
#parse ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/ooxml_parser/xlsx_parser/xlsx_data/view_model/workbook/style_sheet.rb', line 21 def parse doc = Nokogiri::XML(File.open("#{OOXMLDocumentObject.path_to_folder}/#{OOXMLDocumentObject.root_subfolder}/styles.xml")) doc.root.xpath('*').each do |node_child| case node_child.name when 'numFmts' @number_formats.parse(node_child) when 'fonts' @fonts.parse(node_child) when 'fills' @fills.parse(node_child) end end self end |