Convert Doc to HTML in Ruby

Aspose.Words - Doc to HTML

Here is example code for converting document to HTML using Aspose.Words Java for Ruby.

Ruby Code

## The path to the documents directory.

data_dir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/data/'
\# Open the document.
doc = Rjb::import('com.aspose.words.Document').new(data_dir + "TestFile.doc")

### options = new HtmlSaveOptions();

options = Rjb::import('com.aspose.words.HtmlSaveOptions').new
\# HtmlSaveOptions.ExportRoundtripInformation property specifies
\# whether to write the roundtrip information when saving to HTML, MHTML or EPUB.
\# Default value is true for HTML and false for MHTML and EPUB.
options.setExportRoundtripInformation(true)
doc.save(data_dir + "ExportRoundtripInformation Out.html", options)
doc = Rjb::import('com.aspose.words.Document').new(data_dir + "ExportRoundtripInformation Out.html")
\# Save the document Docx file format
save_format = Rjb::import('com.aspose.words.SaveFormat')
doc.save(data_dir + "Out.docx", save_format.DOCX)

Download Running Code

Download Doc to HTML (Aspose.Words) from any of the below mentioned social coding sites: