class OoxmlParser::FormProperties

Class for parsing ‘formPr` tag

Attributes

border[R]

@return [BordersProperties] border of field

help_text[R]

@return [String] text of tooltip

key[R]

@return [String] field key

required[R]

@return [True, False] specifies if field is required

shade[R]

@return [Shade] shade of field

Public Class Methods

new(parent: nil) click to toggle source
Calls superclass method OoxmlParser::OOXMLDocumentObject::new
# File lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb, line 17
def initialize(parent: nil)
  @required = false
  super
end

Public Instance Methods

parse(node) click to toggle source

Parse FormProperties object @param node [Nokogiri::XML:Element] node to parse @return [FormProperties] result of parsing

# File lib/ooxml_parser/docx_parser/document_structure/docx_paragraph/sdt/sdt_properties/form_properties.rb, line 25
def parse(node)
  node.attributes.each do |key, value|
    case key
    when 'key'
      @key = value.value
    when 'helpText'
      @help_text = value.value
    when 'required'
      @required = boolean_attribute_value(value)
    end
  end

  node.xpath('*').each do |node_child|
    case node_child.name
    when 'shd'
      @shade = Shade.new(parent: self).parse(node_child)
    when 'border'
      @border = BordersProperties.new(parent: self).parse(node_child)
    end
  end
  self
end