Class: DocumentToRichHtml::WordConverter
- Inherits:
-
Object
- Object
- DocumentToRichHtml::WordConverter
- Defined in:
- lib/document_to_rich_html/word_converter.rb
Class Method Summary collapse
Class Method Details
.convert(file_path) ⇒ Object
7 8 9 10 |
# File 'lib/document_to_rich_html/word_converter.rb', line 7 def self.convert(file_path) content = extract_content(file_path) HtmlFormatter.format(content) end |
.extract_content(file_path) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/document_to_rich_html/word_converter.rb', line 12 def self.extract_content(file_path) doc = Docx::Document.open(file_path) html = '<div class="word-document">' doc.paragraphs.each do |paragraph| html += "<p>#{paragraph.to_html}</p>" end html += '</div>' html end |