class OoxmlParser::ParagraphBorders

Class for parsing `w:pBdr` element

Attributes

bar[RW]

@return [BordersProperties] bar properties

between[RW]

@return [BordersProperties] between properties

bottom[RW]

@return [BordersProperties] bottom properties

left[RW]

@return [BordersProperties] left properties

right[RW]

@return [BordersProperties] right properties

top[RW]

@return [BordersProperties] top properties

Public Instance Methods

border_visual_type() click to toggle source

@return [Symbol] type of border in visual editor

# File lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb, line 20
def border_visual_type
  result = []
  result << :left if @left.val == :single
  result << :right if @right.val == :single
  result << :top if @top.val == :single
  result << :bottom if @bottom.val == :single
  result << :inner if @between.val == :single
  return :none if result == []
  return :all if result == %i[left right top bottom inner]
  return :outer if result == %i[left right top bottom]

  result.first if result.size == 1
end
parse(node) click to toggle source

Parse Paragraph Borders data @param [Nokogiri::XML:Element] node with Paragraph Borders data @return [ParagraphBorders] value of Paragraph Borders data

# File lib/ooxml_parser/common_parser/common_data/paragraph/paragrpah_properties/paragraph_borders.rb, line 37
def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'bottom'
      @bottom = BordersProperties.new(parent: self).parse(node_child)
    when 'left'
      @left = BordersProperties.new(parent: self).parse(node_child)
    when 'top'
      @top = BordersProperties.new(parent: self).parse(node_child)
    when 'right'
      @right = BordersProperties.new(parent: self).parse(node_child)
    when 'between'
      @between = BordersProperties.new(parent: self).parse(node_child)
    when 'bar'
      @bar = BordersProperties.new(parent: self).parse(node_child)
    end
  end
  self
end