Class: DocxGenerator::Word::Indentation

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

Overview

Represent the ‘w:indent` 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(arguments = {}) ⇒ Indentation

Create a new ‘w:indent` element.

Parameters:

  • properties (Hash)

    The different properties for the indentation. They can be found in the specification.



82
83
84
85
86
87
88
89
90
91
92
# File 'lib/docx_generator/word/formatting.rb', line 82

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