Sha256: 66d93c874b0bae6ce74637511e2d12b4daa6c548dda0fc242440a4f1092e15a1

Contents?: true

Size: 1.74 KB

Versions: 46

Compression:

Stored size: 1.74 KB

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for data with FrameProperties
  class FrameProperties < OOXMLDocumentObject
    attr_accessor :drop_cap, :lines, :wrap, :vertical_anchor, :horizontal_anchor, :width, :height, :height_rule,
                  :horizontal_align, :vertical_align, :anchor_lock, :vertical_space, :horizontal_space,
                  :horizontal_position, :vertical_position

    # Parse FrameProperties
    # @param node [Nokogiri::XML:Element] with FrameProperties
    # @return [FrameProperties] parsed result
    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
  end
end

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
ooxml_parser-0.38.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.37.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.37.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.36.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.36.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.35.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.34.2 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.34.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.34.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.33.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.32.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.31.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.30.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.29.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.28.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.27.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.26.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.25.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.24.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/frame_properties.rb
ooxml_parser-0.23.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/docx_paragraph/frame_properties.rb