class Docxi::Word::Footers::Footer
Attributes
content[RW]
id[RW]
options[RW]
relationships[RW]
sequence[RW]
Public Class Methods
new(options={}) { |self| ... }
click to toggle source
# File lib/docxi/word/footers/footer.rb, line 9 def initialize(options={}) @options = options @content = [] @relationships = [] if block_given? yield self else end end
Public Instance Methods
br(options={})
click to toggle source
# File lib/docxi/word/footers/footer.rb, line 21 def br(options={}) br = Docxi::Word::Contents::Break.new(options) @content << br br end
content_type()
click to toggle source
# File lib/docxi/word/footers/footer.rb, line 27 def content_type "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer" end
page_numbers(options={})
click to toggle source
# File lib/docxi/word/footers/footer.rb, line 54 def page_numbers(options={}) numbers = PageNumbers.new(options) @content << numbers numbers end
render(zip)
click to toggle source
# File lib/docxi/word/footers/footer.rb, line 35 def render(zip) zip.put_next_entry("word/#{target}") zip.write(Docxi.to_xml(document)) if !@relationships.empty? zip.put_next_entry("word/_rels/#{target}.rels") zip.write(Docxi.to_xml(relationships)) end end
table(options={}, &block)
click to toggle source
# File lib/docxi/word/footers/footer.rb, line 60 def table(options={}, &block) table = Docxi::Word::Contents::Table.new(options, &block) @content << table table end
target()
click to toggle source
# File lib/docxi/word/footers/footer.rb, line 31 def target "footer#{id}.xml" end
text(text, options={})
click to toggle source
# File lib/docxi/word/footers/footer.rb, line 45 def text(text, options={}) options = @options.merge(options) element = Docxi::Word::Contents::Paragraph.new(options) do |p| p.text(text) end @content << element element end
Private Instance Methods
document()
click to toggle source
# File lib/docxi/word/footers/footer.rb, line 114 def document Nokogiri::XML::Builder.with(Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>')) do |xml| xml.ftr( 'xmlns:wpc' => "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas", 'xmlns:mc' => "http://schemas.openxmlformats.org/markup-compatibility/2006", 'xmlns:o' => "urn:schemas-microsoft-com:office:office", 'xmlns:r' => "http://schemas.openxmlformats.org/officeDocument/2006/relationships", 'xmlns:m' => "http://schemas.openxmlformats.org/officeDocument/2006/math", 'xmlns:v' => "urn:schemas-microsoft-com:vml", 'xmlns:wp14' => "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing", 'xmlns:wp' => "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", 'xmlns:w10' => "urn:schemas-microsoft-com:office:word", 'xmlns:w' => "http://schemas.openxmlformats.org/wordprocessingml/2006/main", 'xmlns:w14' => "http://schemas.microsoft.com/office/word/2010/wordml", 'xmlns:wpg' => "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", 'xmlns:wpi' => "http://schemas.microsoft.com/office/word/2010/wordprocessingInk", 'xmlns:wne' => "http://schemas.microsoft.com/office/word/2006/wordml", 'xmlns:wps' => "http://schemas.microsoft.com/office/word/2010/wordprocessingShape", 'mc:Ignorable' => "w14 wp14" ) do xml.parent.namespace = xml.parent.namespace_definitions.find{|ns| ns.prefix == "w" } @content.each do |element| element.render(xml) end end end end