Method: Docxi::Properties::Core#document

Defined in:
lib/docxi/properties/core.rb

#documentObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/docxi/properties/core.rb', line 11

def document
  Nokogiri::XML::Builder.with(Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>')) do |xml|
    xml.coreProperties('xmlns:cp' => 'http://schemas.openxmlformats.org/package/2006/metadata/core-properties', 'xmlns:dc' => 'http://purl.org/dc/elements/1.1/', 'xmlns:dcterms' => 'http://purl.org/dc/terms/', 'xmlns:dcmitype' => 'http://purl.org/dc/dcmitype/', 'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance') do
      xml.parent.namespace = xml.parent.namespace_definitions.find{|ns| ns.prefix=="cp" }
      # xml['dc'].title options[:title]
      xml['dc'].creator do
        options[:creator]
      end
      xml['cp'].lastModifiedBy do
        options[:creator]
      end
      xml['cp'].revision 1
      xml['dcterms'].created(Time.now.strftime('%Y-%m-%dT%H:%M:%SZ'), 'xsi:type' => 'dcterms:W3CDTF')
      xml['dcterms'].modified(Time.now.strftime('%Y-%m-%dT%H:%M:%SZ'), 'xsi:type' => 'dcterms:W3CDTF')
    end
  end
end