! /usr/bin/perl use strict; use warnings; use File::Spec::Functions qw( catfile ); use Win32::OLE; use Win32::OLE::Const 'Microsoft Word'; $Win32::OLE::Warn = 3; my $word = get_word(); $word->{Visible} = 1; my $doc = $word->{Documents}->Open(catfile $ENV{TEMP}, 'test. Doc'); $doc->Repaginate; my $props = $doc->BuiltInDocumentProperties; my $x = $props->Item(wdPropertyPages)->valof; print "$x\n"; $doc->Close(0); sub get_word { my $word; eval { $word = Win32::OLE->GetActiveObject('Word.
Application'); }; die "$@\n" if $@; unless(defined $word) { $word = Win32::OLE->new('Word. Application', sub { $_0->Quit }) or die "Oops, cannot start Word: ", Win32::OLE->LastError, "\n"; } return $word; }.
This works. The $doc->Repaginate was what I was after. Thanks.
What is the difference between ->valof and ->value? – Matthew Farwell May 5 '09 at 8:10 I hate to admit it. I am not too sure about the difference between valof and value or even {Value}.
The script I posted is adopted from something else I had written. Now that you mentioned it, $doc->BuiltInDocumentProperties->Item(wdPropertyPages)->{Value}; $doc->BuiltInDocumentProperties->Item(wdPropertyPages)->Value; $doc->BuiltInDocumentProperties->Item(wdPropertyPages)->valof; all give the same result. This is something to look into but, just for aesthetic reasons, I would stick with ->Value.
– Sinan Ünür May 5 '09 at 8:41.
I'm wondering if page-count is dependent upon the currently selected printer/setup, and the "Perl printer" (whatever that is) is setup differently than the actual one used by Word itself.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.