Heesob Park
12/12/2008 1:45:00 PM
2008/12/12 Talib Hussain <talibhn@gmail.com>:
> Hi,
>
> I have a 3 paged document, I want to read contents of each page. How cn
> i do that.
>
If you want only text contents, try this
require 'win32ole'
word = WIN32OLE.new('word.application')
file = 'c:/work/test.doc'
doc = word.documents.open(file,'ReadOnly' => true)
page = doc.ComputeStatistics(2) # wdStatisticPages = 2
for i in 1..page
word.selection.goto(1,1,i) # wdGoToPage = 1
word.selection.goto(-1,0,0,'\page') # wdGoToBookmark = -1
puts "PAGE #{i}"
puts word.selection.text
end
word.activedocument.close(false)
word.quit
Regards,
Park Heesob