Class: OoxmlParser::DocumentBackground
- Inherits:
-
OOXMLDocumentObject
- Object
- OOXMLDocumentObject
- OoxmlParser::DocumentBackground
- Defined in:
- lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb
Overview
Class for describing Document Background w:background
Instance Attribute Summary collapse
-
#color1 ⇒ Object
readonly
Returns the value of attribute color1.
-
#color2 ⇒ Object
readonly
Returns the value of attribute color2.
-
#file_reference ⇒ FileReference
readonly
Image structure.
-
#fill ⇒ Fill
readonly
Fill data.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Attributes inherited from OOXMLDocumentObject
Instance Method Summary collapse
-
#initialize(parent: nil) ⇒ DocumentBackground
constructor
A new instance of DocumentBackground.
-
#parse(node) ⇒ DocumentBackground
Parse DocumentBackground 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) ⇒ DocumentBackground
Returns a new instance of DocumentBackground.
10 11 12 13 14 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb', line 10 def initialize(parent: nil) @color1 = nil @type = 'simple' @parent = parent end |
Instance Attribute Details
#color1 ⇒ Object (readonly)
Returns the value of attribute color1.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb', line 4 def color1 @color1 end |
#color2 ⇒ Object (readonly)
Returns the value of attribute color2.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb', line 4 def color2 @color2 end |
#file_reference ⇒ FileReference (readonly)
Returns image structure.
6 7 8 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb', line 6 def file_reference @file_reference end |
#fill ⇒ Fill (readonly)
Returns fill data.
8 9 10 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb', line 8 def fill @fill end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb', line 4 def size @size end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb', line 4 def type @type end |
Instance Method Details
#parse(node) ⇒ DocumentBackground
Parse DocumentBackground object
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb', line 19 def parse(node) @color1 = Color.new(parent: self).parse_hex_string(node.attribute('color').value) node.xpath('v:background').each do |second_color| @size = second_color.attribute('targetscreensize').value.sub(',', 'x') unless second_color.attribute('targetscreensize').nil? second_color.xpath('*').each do |node_child| case node_child.name when 'fill' @fill = Fill.new(parent: self).parse(node_child) end end end self end |