Class: Docx::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/docx/html.rb

Instance Method Summary collapse

Instance Method Details

#to_html(options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/docx/html.rb', line 8

def to_html(options={})
  HtmlWriter.new.write do |html|
    html.doctype options[:doctype] || 5
    html.head do |head|
      head.title options[:title] || ''
    end
    html.body do |body|
      self.each_paragraph do |paragraph|
        body.p paragraph.text_runs.map{ |tr| inline_content_for(tr) }.join('')
      end
    end
  end
end