Class: Docxer::Word::Footers::Footer::PageNumbers

Inherits:
Object
  • Object
show all
Defined in:
lib/docxer/word/footers/footer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PageNumbers

Returns a new instance of PageNumbers.



57
58
59
# File 'lib/docxer/word/footers/footer.rb', line 57

def initialize(options={})
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



56
57
58
# File 'lib/docxer/word/footers/footer.rb', line 56

def options
  @options
end

Instance Method Details

#render(xml) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/docxer/word/footers/footer.rb', line 61

def render(xml)
  xml['w'].sdt do
    xml['w'].sdtPr do
      xml['w'].id( 'w:val' => "-472213903" )
      xml['w'].docPartObj do
        xml['w'].docPartGallery( 'w:val' => "Page Numbers (Bottom of Page)" )
        xml['w'].docPartUnique
      end
    end
    xml['w'].sdtContent do
      xml['w'].p do
        xml['w'].pPr do
          xml['w'].jc( 'w:val' => @options[:align] || 'right' )
        end
        xml['w'].r do
          xml['w'].fldChar( 'w:fldCharType' => "begin" )
        end
        xml['w'].r do
          xml['w'].instrText "PAGE   \* MERGEFORMAT"
        end
        xml['w'].r do
          xml['w'].fldChar( 'w:fldCharType' => "separate" )
        end
        xml['w'].r do
          xml['w'].fldChar( 'w:fldCharType' => "end" )
        end
      end
    end
  end
end