[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to Count pages in a word document

Talib Hussain

12/12/2008 6:29:00 AM

Hi,

Could you let me know how can I count the no. of pages in a Word
document using Ruby?

TIA,
Talib Hussain
--
Posted via http://www.ruby-....

5 Answers

Talib Hussain

12/12/2008 8:22:00 AM

0

Talib Hussain wrote:
> Hi,
>
> Could you let me know how can I count the no. of pages in a Word
> document using Ruby?
>
> TIA,
> Talib Hussain

No replies i am surprised
--
Posted via http://www.ruby-....

Heesob Park

12/12/2008 8:55:00 AM

0

Hi,

2008/12/12 Talib Hussain <talibhn@gmail.com>:
> 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,

Park Heesob

Richard Conroy

12/12/2008 9:48:00 AM

0

On Fri, Dec 12, 2008 at 8:54 AM, Heesob Park <phasis@gmail.com> wrote:
> Hi,
>
> 2008/12/12 Talib Hussain <talibhn@gmail.com>:
>> 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.blo... to be a great
resource for these kinds of things.
Well worth a look if you are stuck on similar problems.

Talib Hussain

12/12/2008 10:05:00 AM

0

Heesob Park wrote:
> Hi,
>
> 2008/12/12 Talib Hussain <talibhn@gmail.com>:
>> Hi,
>>


Thanks a lot .... This has make life easier
--
Posted via http://www.ruby-....

Zhenning Guan

12/13/2008 10:23:00 AM

0

Talib Hussain wrote:
> Hi,
>
> Could you let me know how can I count the no. of pages in a Word
> document using Ruby?
>
> TIA,
> Talib Hussain
take a look at Ruby cookbook.
--
Posted via http://www.ruby-....