Sha256: 29a1b25ec339f9a4d7d4b18605d283d73d3295dbc3f86afd469949bc969e9d7f

Contents?: true

Size: 1.05 KB

Versions: 39

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for working with ParagraphMargins
  class ParagraphMargins < TableMargins
    def initialize(top = OoxmlSize.new(0),
                   bottom = OoxmlSize.new(0),
                   left = OoxmlSize.new(0),
                   right = OoxmlSize.new(0),
                   parent: nil)
      super(true, top, bottom, left, right, parent: parent)
    end

    # Parse ParagraphMargins object
    # @param text_body_props_node [Nokogiri::XML:Element] node to parse
    # @return [ParagraphMargins] result of parsing
    def parse(text_body_props_node)
      text_body_props_node.attributes.each do |key, value|
        case key
        when 'bIns', 'marB'
          @bottom = OoxmlSize.new(value.value.to_f, :emu)
        when 'tIns', 'marT'
          @top = OoxmlSize.new(value.value.to_f, :emu)
        when 'lIns', 'marL'
          @left = OoxmlSize.new(value.value.to_f, :emu)
        when 'rIns', 'marR'
          @right = OoxmlSize.new(value.value.to_f, :emu)
        end
      end
      self
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
ooxml_parser-0.37.1 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.37.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.36.1 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.36.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.35.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.34.2 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.34.1 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.34.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.33.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.32.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.31.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.30.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.29.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.28.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.27.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.26.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.25.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.24.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.23.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb
ooxml_parser-0.22.0 lib/ooxml_parser/common_parser/common_data/table/margins/paragraph_margins.rb