Sha256: 3ea5cc66752b950bfc840084d6cd59afc7e4aae3e4caa805c2d5044359afe428

Contents?: true

Size: 1.46 KB

Versions: 8

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

require_relative 'form_text_properties/form_text_comb'
require_relative 'form_text_properties/form_text_format'
module OoxmlParser
  # Class for parsing `textFormPr` tag
  class FormTextProperties < OOXMLDocumentObject
    # @return [True, False] specifies if field is multiline
    attr_reader :multiline
    # @return [True, False] specifies if size of field should be autofit
    attr_reader :autofit
    # @return [FormTextComb] parameters of text justification
    attr_reader :comb
    # @return [ValuedChild] characters limit
    attr_reader :maximum_characters
    # @return [FormTextFormat] text format
    attr_reader :format

    # Parse FormTextProperties object
    # @param node [Nokogiri::XML:Element] node to parse
    # @return [FormTextProperties] result of parsing
    def parse(node)
      node.attributes.each do |key, value|
        case key
        when 'multiLine'
          @multiline = boolean_attribute_value(value)
        when 'autoFit'
          @autofit = boolean_attribute_value(value)
        end
      end

      node.xpath('*').each do |node_child|
        case node_child.name
        when 'comb'
          @comb = FormTextComb.new(parent: self).parse(node_child)
        when 'maxCharacters'
          @maximum_characters = ValuedChild.new(:integer, parent: self).parse(node_child)
        when 'format'
          @format = FormTextFormat.new(parent: self).parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ooxml_parser-0.37.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb
ooxml_parser-0.37.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb
ooxml_parser-0.36.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb
ooxml_parser-0.36.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb
ooxml_parser-0.35.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb
ooxml_parser-0.34.2 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb
ooxml_parser-0.34.1 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb
ooxml_parser-0.34.0 lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb