class OoxmlParser::DocumentBackground
Class for describing Document Background
‘w:background`
Attributes
@return [FileReference] image structure
@return [Fill] fill data
Public Class Methods
Source
# File lib/ooxml_parser/docx_parser/document_structure/document_background.rb, line 12 def initialize(parent: nil) @color1 = nil @type = 'simple' super end
Calls superclass method
OoxmlParser::OOXMLDocumentObject::new
Public Instance Methods
Source
# File lib/ooxml_parser/docx_parser/document_structure/document_background.rb, line 21 def parse(node) node.attributes.each do |key, value| case key when 'color' @color1 = Color.new(parent: self).parse_hex_string(value.value) end end 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
Parse DocumentBackground
object @param node [Nokogiri::XML:Element] node to parse @return [DocumentBackground] result of parsing