Sha256: 22c4ff184c7e5a7309353b640f1895f71ee6084a622b4cf8bc848f4676a91e04
Contents?: true
Size: 1.49 KB
Versions: 2
Compression:
Stored size: 1.49 KB
Contents
require_relative 'docx_color' require_relative 'docx_shape_size' require_relative 'docx_shape_line' require_relative 'docx_shape_properties/text_box' require_relative 'custom_geometry/ooxml_custom_geometry' # DOCX Shape Properties module OoxmlParser class DocxShapeProperties < OOXMLDocumentObject attr_accessor :shape_size, :preset_geometry, :fill_color, :text_box, :line, :custom_geometry alias transform shape_size alias fill fill_color alias preset preset_geometry def initialize @line = DocxShapeLine.new end def self.parse(shape_properties_node) shape_properties = DocxShapeProperties.new shape_properties.fill_color = DocxColor.parse(shape_properties_node) shape_properties_node.xpath('*').each do |shape_properties_node_child| case shape_properties_node_child.name when 'xfrm' shape_properties.shape_size = DocxShapeSize.parse(shape_properties_node_child) when 'prstGeom' shape_properties.preset_geometry = shape_properties_node_child.attribute('prst').value.to_sym when 'txbx' shape_properties.text_box = TextBox.parse_list(shape_properties_node_child) when 'ln' shape_properties.line = DocxShapeLine.parse(shape_properties_node_child) when 'custGeom' shape_properties.preset_geometry = :custom shape_properties.custom_geometry = OOXMLCustomGeometry.parse(shape_properties_node_child) end end shape_properties end end end
Version data entries
2 entries across 2 versions & 1 rubygems