class Docxer::Word::Footers::Footer::PageNumbers

Attributes

options[RW]

Public Class Methods

new(options={}) click to toggle source
# File lib/docxer/word/footers/footer.rb, line 57
def initialize(options={})
  @options = options
end

Public Instance Methods

render(xml) click to toggle source
# 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