Class: OoxmlParser::FormTextProperties

Inherits:
OOXMLDocumentObject show all
Defined in:
lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb

Overview

Class for parsing ‘textFormPr` tag

Instance Attribute Summary collapse

Attributes inherited from OOXMLDocumentObject

#parent

Instance Method Summary collapse

Methods inherited from OOXMLDocumentObject

#==, #boolean_attribute_value, #initialize, #parse_xml, #with_data?

Methods included from OoxmlObjectAttributeHelper

#attribute_enabled?, #option_enabled?

Methods included from OoxmlDocumentObjectHelper

#to_hash

Constructor Details

This class inherits a constructor from OoxmlParser::OOXMLDocumentObject

Instance Attribute Details

#autofitTrue, False (readonly)

Returns specifies if size of field should be autofit.

Returns:

  • (True, False)

    specifies if size of field should be autofit



11
12
13
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb', line 11

def autofit
  @autofit
end

#combFormTextComb (readonly)

Returns parameters of text justification.

Returns:



13
14
15
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb', line 13

def comb
  @comb
end

#formatFormTextFormat (readonly)

Returns text format.

Returns:



17
18
19
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb', line 17

def format
  @format
end

#maximum_charactersValuedChild (readonly)

Returns characters limit.

Returns:



15
16
17
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb', line 15

def maximum_characters
  @maximum_characters
end

#multilineTrue, False (readonly)

Returns specifies if field is multiline.

Returns:

  • (True, False)

    specifies if field is multiline



9
10
11
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb', line 9

def multiline
  @multiline
end

Instance Method Details

#parse(node) ⇒ FormTextProperties

Parse FormTextProperties object

Parameters:

  • node (Nokogiri::XML:Element)

    node to parse

Returns:



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_text_properties.rb', line 22

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