Class: OoxmlParser::FrameProperties

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#anchor_lockObject

Returns the value of attribute anchor_lock.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def anchor_lock
  @anchor_lock
end

#drop_capObject

Returns the value of attribute drop_cap.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def drop_cap
  @drop_cap
end

#heightObject

Returns the value of attribute height.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def height
  @height
end

#height_ruleObject

Returns the value of attribute height_rule.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def height_rule
  @height_rule
end

#horizontal_alignObject

Returns the value of attribute horizontal_align.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def horizontal_align
  @horizontal_align
end

#horizontal_anchorObject

Returns the value of attribute horizontal_anchor.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def horizontal_anchor
  @horizontal_anchor
end

#horizontal_positionObject

Returns the value of attribute horizontal_position.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def horizontal_position
  @horizontal_position
end

#horizontal_spaceObject

Returns the value of attribute horizontal_space.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def horizontal_space
  @horizontal_space
end

#linesObject

Returns the value of attribute lines.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def lines
  @lines
end

#vertical_alignObject

Returns the value of attribute vertical_align.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def vertical_align
  @vertical_align
end

#vertical_anchorObject

Returns the value of attribute vertical_anchor.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def vertical_anchor
  @vertical_anchor
end

#vertical_positionObject

Returns the value of attribute vertical_position.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def vertical_position
  @vertical_position
end

#vertical_spaceObject

Returns the value of attribute vertical_space.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def vertical_space
  @vertical_space
end

#widthObject

Returns the value of attribute width.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def width
  @width
end

#wrapObject

Returns the value of attribute wrap.



3
4
5
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 3

def wrap
  @wrap
end

Class Method Details

.parse(frame_pr_node) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb', line 7

def self.parse(frame_pr_node)
  frame_properties = FrameProperties.new
  frame_pr_node.attributes.each do |key, value|
    case key
    when 'dropCap'
      frame_properties.drop_cap = value.value.to_sym
    when 'lines'
      frame_properties.lines = value.value.to_i
    when 'wrap'
      frame_properties.lines = value.value.to_sym
    when 'vAnchor'
      frame_properties.vertical_anchor = value.value.to_sym
    when 'hAnchor'
      frame_properties.horizontal_anchor = value.value.to_sym
    when 'w'
      frame_properties.width = (value.value.to_f / 566.9).round(2)
    when 'h'
      frame_properties.height = (value.value.to_f / 566.9).round(2)
    when 'hRule'
      frame_properties.height_rule = value.value.to_s.sub('atLeast', 'at_least').to_sym
    when 'xAlign'
      frame_properties.horizontal_align = value.value.to_sym
    when 'yAlign'
      frame_properties.vertical_align = value.value.to_sym
    when 'anchorLock'
      frame_properties.anchor_lock = OOXMLDocumentObject.option_enabled?(frame_pr_node, 'anchorLock')
    when 'vSpace'
      frame_properties.vertical_space = (value.value.to_f / 566.9).round(2)
    when 'hSpace'
      frame_properties.horizontal_space = (value.value.to_f / 566.9).round(2)
    when 'x'
      frame_properties.horizontal_position = (value.value.to_f / 566.9).round(2)
    when 'y'
      frame_properties.vertical_position = (value.value.to_f / 566.9).round(2)
    end
  end
  frame_properties
end