Class: DocxGenerator::Word::Tab

Inherits:
Element
  • Object
show all
Defined in:
lib/docx_generator/word/formatting.rb

Overview

Represent the ‘w:tab` element from Office Open XML specification. This class should not be used directly by the users of the library.

Instance Method Summary collapse

Methods inherited from Element

#add, #generate

Constructor Details

#initialize(options = {}) ⇒ Tab

Create a new ‘w:tab` element.

Parameters:

  • options (Hash) (defaults to: {})

    Options for the tab stop. Must be ‘leader`, `pos` or `val`. See the specification for the possible values for each option.



111
112
113
114
115
116
117
118
119
120
121
# File 'lib/docx_generator/word/formatting.rb', line 111

def initialize(options = {})
  final_arguments = {}
  options.each do |name, value|
    if name.to_s == "pos"
      final_arguments["w:pos"] = (value * 20).round
    else
      final_arguments["w:" + name.to_s] = value
    end
  end
  super("w:tab", final_arguments)
end