Class: OoxmlParser::StyleSheet
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::StyleSheet
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/style_sheet.rb
Overview
Parsing file styles.xml
Instance Attribute Summary collapse
-
#borders ⇒ XlsxBorders
readonly
Cell XFs.
-
#cell_xfs ⇒ CellXfs
readonly
Cell XFs.
-
#differential_formatting_records ⇒ DifferentialFormattingRecords
readonly
List of differential formatting records.
-
#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 ⇒ StyleSheet
Parse StyleSheet object.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
#initialize(parent: nil) ⇒ StyleSheet
Returns a new instance of StyleSheet.
25 26 27 28 29 30 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet.rb', line 25 def initialize(parent: nil) @number_formats = NumberFormats.new(parent: self) @fonts = Fonts.new(parent: self) @fills = Fills.new(parent: self) super end |
Instance Attribute Details
#borders ⇒ XlsxBorders (readonly)
Returns Cell XFs.
21 22 23 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet.rb', line 21 def borders @borders end |
#cell_xfs ⇒ CellXfs (readonly)
Returns Cell XFs.
19 20 21 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet.rb', line 19 def cell_xfs @cell_xfs end |
#differential_formatting_records ⇒ DifferentialFormattingRecords (readonly)
Returns list of differential formatting records.
23 24 25 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet.rb', line 23 def differential_formatting_records @differential_formatting_records end |
#fills ⇒ Fills
Returns fills.
17 18 19 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet.rb', line 17 def fills @fills end |
#fonts ⇒ Fonts
Returns fonts.
15 16 17 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet.rb', line 15 def fonts @fonts end |
#number_formats ⇒ NumberFormats
Returns number formats.
13 14 15 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet.rb', line 13 def number_formats @number_formats end |
Instance Method Details
#parse ⇒ StyleSheet
Parse StyleSheet object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/style_sheet.rb', line 34 def parse doc = parse_xml("#{root_object.unpacked_folder}/#{root_object.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) when 'cellXfs' @cell_xfs = CellXfs.new(parent: self).parse(node_child) when 'borders' @borders = XlsxBorders.new(parent: self).parse(node_child) when 'dxfs' @differential_formatting_records = DifferentialFormattingRecords.new(parent: self).parse(node_child) end end self end |