Class: Word
- Defined in:
- lib/helpers/jruby/word.rb,
lib/helpers/jruby/word.rb
Instance Attribute Summary collapse
-
#doc ⇒ Object
readonly
Returns the value of attribute doc.
-
#wd ⇒ Object
readonly
Returns the value of attribute wd.
Instance Method Summary collapse
-
#initialize(visible) ⇒ Word
constructor
A new instance of Word.
- #open(file) ⇒ Object
- #quit ⇒ Object
- #save ⇒ Object
-
#save_as(name, format) ⇒ Object
Format : From WORD_OLE_CONST e.g WORD_OLE_CONST::WdFormatHTML.
-
#save_as_html(name) ⇒ Object
WdFormatFilteredHTML WdFormatHTML.
Constructor Details
#initialize(visible) ⇒ Word
Returns a new instance of Word.
38 39 40 41 42 43 44 |
# File 'lib/helpers/jruby/word.rb', line 38 def initialize( visible ) @wd = WIN32OLE.new('Word.Application') WIN32OLE.const_load(@wd, WORD_OLE_CONST) if WORD_OLE_CONST.constants.empty? @wd.Visible = visible end |
Instance Attribute Details
#doc ⇒ Object (readonly)
Returns the value of attribute doc.
36 37 38 |
# File 'lib/helpers/jruby/word.rb', line 36 def doc @doc end |
#wd ⇒ Object (readonly)
Returns the value of attribute wd.
36 37 38 |
# File 'lib/helpers/jruby/word.rb', line 36 def wd @wd end |
Instance Method Details
#open(file) ⇒ Object
46 47 48 49 |
# File 'lib/helpers/jruby/word.rb', line 46 def open(file) @doc = @wd.Documents.Open(file) @doc end |
#quit ⇒ Object
70 71 72 |
# File 'lib/helpers/jruby/word.rb', line 70 def quit @wd.quit() end |
#save ⇒ Object
51 52 53 54 |
# File 'lib/helpers/jruby/word.rb', line 51 def save() @doc.Save() @doc end |
#save_as(name, format) ⇒ Object
Format : From WORD_OLE_CONST e.g WORD_OLE_CONST::WdFormatHTML
58 59 60 61 |
# File 'lib/helpers/jruby/word.rb', line 58 def save_as(name, format) @doc.SaveAs(name, format) return @doc end |
#save_as_html(name) ⇒ Object
WdFormatFilteredHTML WdFormatHTML
65 66 67 68 |
# File 'lib/helpers/jruby/word.rb', line 65 def save_as_html(name) @doc.SaveAs(name, WORD_OLE_CONST::WdFormatHTML) return @doc end |