From: Richard Conroy Date: 2008-12-12T18:48:26+09:00 Subject: Re: How to Count pages in a word document On Fri, Dec 12, 2008 at 8:54 AM, Heesob Park wrote: > Hi, > > 2008/12/12 Talib Hussain : >> Hi, >> >> Could you let me know how can I count the no. of pages in a Word >> document using Ruby? >> > 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 > word.activedocument.close(false) > word.quit > puts page > > > HTH, I have found: http://rubyonwindows.blogspot.com/ to be a great resource for these kinds of things. Well worth a look if you are stuck on similar problems.