Sha256: 1b24f08081acc1f0e31f8636301f9131b087969684d4df0a1047d54d61666903
Contents?: true
Size: 1.17 KB
Versions: 9
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true module OoxmlParser # Class for describing Document Background `w:background` class DocumentBackground < OOXMLDocumentObject attr_reader :color1, :size, :color2, :type # @return [FileReference] image structure attr_reader :file_reference # @return [Fill] fill data attr_reader :fill def initialize(parent: nil) @color1 = nil @type = 'simple' super end # Parse DocumentBackground object # @param node [Nokogiri::XML:Element] node to parse # @return [DocumentBackground] result of parsing 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 end end
Version data entries
9 entries across 9 versions & 1 rubygems