Sha256: 3c1a0e39135f29db26379c5e360dd2306b1ae05f83ef64f2b0ba601876eae564
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
module OoxmlParser # Class for describing Document Background `w:background` class DocumentBackground < OOXMLDocumentObject attr_accessor :color1, :size, :color2, :type # @return [FileReference] image structure attr_accessor :file_reference def initialize(parent: nil) @color1 = nil @type = 'simple' @parent = parent end # Parse DocumentBackground object # @param node [Nokogiri::XML:Element] node to parse # @return [DocumentBackground] result of parsing def parse(node) @color1 = Color.new(parent: self).parse_hex_string(node.attribute('color').value) node.xpath('v:background').each do |second_color| unless second_color.attribute('targetscreensize').nil? @size = second_color.attribute('targetscreensize').value.sub(',', 'x') end second_color.xpath('v:fill').each do |fill| if !fill.attribute('color2').nil? @color2 = Color.new(parent: self).parse_hex_string(fill.attribute('color2').value.split(' ').first.delete('#')) @type = fill.attribute('type').value elsif !fill.attribute('id').nil? @file_reference = FileReference.new(parent: self).parse(fill) @type = 'image' end end end self end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ooxml_parser-0.2.0 | lib/ooxml_parser/docx_parser/docx_data/document_structure/document_background.rb |