Sha256: e45c42fcd29c36f8d9ac67cd5f5f6728ec144297f7c8782e98470bf7f45d3d8f
Contents?: true
Size: 1.45 KB
Versions: 2
Compression:
Stored size: 1.45 KB
Contents
require_relative 'chart/chart' require_relative 'drawing/docx_drawing' require_relative 'shape/shape' require_relative 'picture/old_docx_picture' # Class for storing fallback graphic elements module OoxmlParser class AlternateContent attr_accessor :office2010_content, :office2007_content def self.parse(alt_content_node) alternate_content = AlternateContent.new alt_content_node.xpath('*').each do |alternate_content_node_child| begin alternate_content_node_child.xpath('w:drawing') rescue Nokogiri::XML::XPath::SyntaxError # This mean it is Chart case alternate_content_node_child.name when 'Choice' alternate_content.office2010_content = Office2010ChartStyle.parse(alternate_content_node_child) when 'Fallback' alternate_content.office2007_content = Office2007ChartStyle.parse(alternate_content_node_child) end next end case alternate_content_node_child.name when 'Choice' alternate_content.office2010_content = DocxDrawing.parse(alternate_content_node_child.xpath('w:drawing').first) unless alternate_content_node_child.xpath('w:drawing').first.nil? when 'Fallback' alternate_content.office2007_content = OldDocxPicture.parse(alternate_content_node_child.xpath('w:pict').first) unless alternate_content_node_child.xpath('w:pict').first.nil? end end alternate_content end end end
Version data entries
2 entries across 2 versions & 1 rubygems