class OoxmlParser::FrameProperties

Class for data with FrameProperties

Attributes

anchor_lock[RW]
drop_cap[RW]
height[RW]
height_rule[RW]
horizontal_align[RW]
horizontal_anchor[RW]
horizontal_position[RW]
horizontal_space[RW]
lines[RW]
vertical_align[RW]
vertical_anchor[RW]
vertical_position[RW]
vertical_space[RW]
width[RW]
wrap[RW]

Public Instance Methods

parse(node) click to toggle source

Parse FrameProperties @param node [Nokogiri::XML:Element] with FrameProperties @return [FrameProperties] parsed result

# File lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb, line 13
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'dropCap'
      @drop_cap = value.value.to_sym
    when 'lines'
      @lines = value.value.to_i
    when 'wrap'
      @lines = value.value.to_sym
    when 'vAnchor'
      @vertical_anchor = value.value.to_sym
    when 'hAnchor'
      @horizontal_anchor = value.value.to_sym
    when 'w'
      @width = OoxmlSize.new(value.value.to_f)
    when 'h'
      @height = OoxmlSize.new(value.value.to_f)
    when 'hRule'
      @height_rule = value.value.to_s.sub('atLeast', 'at_least').to_sym
    when 'xAlign'
      @horizontal_align = value.value.to_sym
    when 'yAlign'
      @vertical_align = value.value.to_sym
    when 'anchorLock'
      @anchor_lock = attribute_enabled?(value)
    when 'vSpace'
      @vertical_space = OoxmlSize.new(value.value.to_f)
    when 'hSpace'
      @horizontal_space = OoxmlSize.new(value.value.to_f)
    when 'x'
      @horizontal_position = OoxmlSize.new(value.value.to_f)
    when 'y'
      @vertical_position = OoxmlSize.new(value.value.to_f)
    end
  end
  self
end