Class: OoxmlParser::XlsxHeaderFooter
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::XlsxHeaderFooter
- Defined in:
- lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb
Overview
Class for parsing <headerFooter> tag
Instance Attribute Summary collapse
-
#align_with_margins ⇒ Symbol
readonly
Specifies whether to align header with margins.
-
#different_first ⇒ Symbol
readonly
Specifies whether first header is different.
-
#different_odd_even ⇒ Symbol
readonly
Specifies whether odd and even headers are different.
-
#even_footer ⇒ String
readonly
Even footer.
-
#even_header ⇒ String
readonly
Even header.
-
#first_footer ⇒ String
readonly
First footer.
-
#first_header ⇒ String
readonly
First header.
-
#odd_footer ⇒ String
readonly
Odd footer.
-
#odd_header ⇒ String
readonly
Odd header.
-
#scale_with_document ⇒ Symbol
readonly
Specifies whether to scale header with document.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#parse(node) ⇒ XlsxHeaderFooter
Parse Header Footer data.
Methods inherited from OOXMLDocumentObject
#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?
Methods included from OoxmlObjectAttributeHelper
#attribute_enabled?, #option_enabled?
Methods included from OoxmlDocumentObjectHelper
Constructor Details
This class inherits a constructor from OoxmlParser::OOXMLDocumentObject
Instance Attribute Details
#align_with_margins ⇒ Symbol (readonly)
Returns Specifies whether to align header with margins.
8 9 10 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb', line 8 def align_with_margins @align_with_margins end |
#different_first ⇒ Symbol (readonly)
Returns Specifies whether first header is different.
10 11 12 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb', line 10 def different_first @different_first end |
#different_odd_even ⇒ Symbol (readonly)
Returns Specifies whether odd and even headers are different.
12 13 14 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb', line 12 def different_odd_even @different_odd_even end |
#even_footer ⇒ String (readonly)
Returns even footer.
22 23 24 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb', line 22 def @even_footer end |
#even_header ⇒ String (readonly)
Returns even header.
20 21 22 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb', line 20 def even_header @even_header end |
#first_footer ⇒ String (readonly)
Returns first footer.
26 27 28 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb', line 26 def @first_footer end |
#first_header ⇒ String (readonly)
Returns first header.
24 25 26 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb', line 24 def first_header @first_header end |
#odd_footer ⇒ String (readonly)
Returns odd footer.
18 19 20 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb', line 18 def @odd_footer end |
#odd_header ⇒ String (readonly)
Returns odd header.
16 17 18 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb', line 16 def odd_header @odd_header end |
#scale_with_document ⇒ Symbol (readonly)
Returns Specifies whether to scale header with document.
14 15 16 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb', line 14 def scale_with_document @scale_with_document end |
Instance Method Details
#parse(node) ⇒ XlsxHeaderFooter
Parse Header Footer data
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ooxml_parser/xlsx_parser/workbook/worksheet/xlsx_header_footer.rb', line 31 def parse(node) node.attributes.each do |key, value| case key when 'alignWithMargins' @align_with_margins = boolean_attribute_value(value) when 'differentFirst' @different_first = boolean_attribute_value(value) when 'differentOddEven' @different_odd_even = boolean_attribute_value(value) when 'scaleWithDoc' @scale_with_document = boolean_attribute_value(value) end node.xpath('*').each do |node_child| case node_child.name when 'oddHeader' @odd_header = HeaderFooterChild.new(parent: parent, type: odd_header).parse(node_child) when 'oddFooter' @odd_footer = HeaderFooterChild.new(parent: parent, type: ).parse(node_child) when 'evenHeader' @even_header = HeaderFooterChild.new(parent: parent, type: even_header).parse(node_child) when 'evenFooter' @even_footer = HeaderFooterChild.new(parent: parent, type: ).parse(node_child) when 'firstHeader' @first_header = HeaderFooterChild.new(parent: parent, type: first_header).parse(node_child) when 'firstFooter' @first_footer = HeaderFooterChild.new(parent: parent, type: ).parse(node_child) end end end self end |