class OpenXml::Docx::Parts::Document
Attributes
children[R]
current_section[R]
relationships[R]
Public Class Methods
new()
click to toggle source
# File lib/openxml/docx/parts/document.rb, line 12 def initialize @children = [] @relationships = OpenXml::Parts::Rels.new end
Public Instance Methods
<<(child)
click to toggle source
# File lib/openxml/docx/parts/document.rb, line 17 def <<(child) if child.is_a?(OpenXml::Docx::Section) set_section(child) else children << child end end
background()
click to toggle source
# File lib/openxml/docx/parts/document.rb, line 34 def background @background ||= OpenXml::Docx::Elements::Background.new end
set_section(section)
click to toggle source
# File lib/openxml/docx/parts/document.rb, line 25 def set_section(section) if current_section.nil? @current_section = section else children.last.section_properties = current_section @current_section = section end end
to_xml()
click to toggle source
# File lib/openxml/docx/parts/document.rb, line 38 def to_xml build_xml do |xml| xml.document(root_namespaces) { xml.parent.namespace = :w background.to_xml(xml) unless @background.nil? xml["w"].body { children.each { |child| child.to_xml(xml) } current_section.to_xml(xml) unless current_section.nil? } } end end