Class: Rubyword::Writer::Part::RelsDocument
- Defined in:
- lib/rubyword/writer/part/rels_document.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Rubyword::Writer::Part::Base
Instance Method Details
#write ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rubyword/writer/part/rels_document.rb', line 6 def write xmlRels = { 'styles.xml' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles', 'numbering.xml' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering', 'settings.xml' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings', 'theme/theme1.xml' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme', 'webSettings.xml' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings', 'fontTable.xml' => 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable', } builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml| xml.Relationships(xmlns: 'http://schemas.openxmlformats.org/package/2006/relationships') do xmlRels.keys.each_with_index do |rel_name, index| id = index + 1 xml.Relationship(Id: "rId#{id}", Type: xmlRels[rel_name], Target: rel_name) end @rubyword.rels_documents.each do |attribute| xml.Relationship(attribute) end end end builder.to_xml end |