How to write C extensions easily in Ruby, by Muriel Salvan, 2012.11.21
在 Ubuntu 上安裝 rmagick
sudo apt-get install libmagick++-dev
sudo gem install rmagick
使用說明
http://www.imagemagick.org/RMagick/doc/
chrahunt/docx
https://github.com/chrahunt/docx
WIN32OLE
http://www.ruby-doc.org/stdlib-2.1.2/libdoc/win32ole/rdoc/WIN32OLE.html
require 'win32ole'
begin
word = WIN32OLE.connect('Word.Application')
doc = word.ActiveDocument
rescue
word = WIN32OLE.new('word.application')
path_open = 'C:\Users\...\test.doc' #yes: backslashes in windows
doc = word.Documents.Open(path_open)
end
word.visible = true doc.Sentences.each { |x| puts x.text }