class OoxmlParser::OOXMLShapeBodyProperties

Class for parsing ‘bodyPr`

Attributes

anchor[RW]
margins[RW]
number_columns[R]

@return [Symbol] Number of Columns

preset_text_warp[RW]
space_columns[R]

@return [Symbol] Spacing between columns

vertical[RW]

@return [Symbol] Vertical Text

vertical_align[RW]
wrap[RW]

Public Instance Methods

parse(node) click to toggle source

Parse OOXMLShapeBodyProperties @param [Nokogiri::XML:Node] node with OOXMLShapeBodyProperties @return [OOXMLShapeBodyProperties] result of parsing

# File lib/ooxml_parser/common_parser/common_data/alternate_content/drawing/graphic/shape/shape_body_properties/ooxml_shape_body_properties.rb, line 21
def parse(node)
  @margins = ParagraphMargins.new(OoxmlSize.new(0.127, :centimeter),
                                  OoxmlSize.new(0.127, :centimeter),
                                  OoxmlSize.new(0.254, :centimeter),
                                  OoxmlSize.new(0.254, :centimeter)).parse(node)
  node.attributes.each do |key, value|
    case key
    when 'wrap'
      @wrap = value.value.to_sym
    when 'anchor'
      @anchor = value_to_symbol(value)
    when 'vert'
      @vertical = value_to_symbol(value)
    when 'numCol'
      @number_columns = value.value.to_i
    when 'spcCol'
      @space_columns = OoxmlSize.new(value.value.to_f, :emu)
    end
  end
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'prstTxWarp'
      @preset_text_warp = PresetTextWarp.new(parent: self).parse(node_child)
    end
  end
  self
end