Class: Doc2Html

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

Constant Summary collapse

VERSION =
'1.0.0'

Instance Method Summary collapse

Instance Method Details

#convertDoc(docpath, savepath) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/doc2html.rb', line 7

def convertDoc(docpath,savepath)
  if File.exists?(docpath)
    docfullpath = File.expand_path(docpath)
    savefullpath = File.expand_path(savepath)
    #p docfullpath
    #p savefullpath
    word = WIN32OLE.new('word.application')
    #word.visible = true
    quitWord = word.documents.count == 0
    word.documents.open(docfullpath)
    word.activedocument.trackrevisions = false
    word.activedocument.revisions.acceptall

    word.activedocument.saveas savefullpath, 10 #wdFormatFilteredHTML 
    word.activedocument.close(false)
    word.quit if quitWord
  end
end