Class: Docxi::Word::Footers::Footer::PageNumbers

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ PageNumbers

Returns a new instance of PageNumbers.



69
70
71
# File 'lib/docxi/word/footers/footer.rb', line 69

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

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



68
69
70
# File 'lib/docxi/word/footers/footer.rb', line 68

def options
  @options
end

Instance Method Details

#render(xml) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/docxi/word/footers/footer.rb', line 73

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'].rPr do
            xml['w'].rFonts( 'w:cs'=> 'Arial', 'w:ascii'=> 'Arial', 'w:hAnsi' => 'Arial' )
            xml['w'].color( 'w:val' => '404040')
            xml['w'].sz( 'w:val' => '20' )
          end
          xml['w'].t @options[:name].to_s+'   '
        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