cormanaz has asked for the wisdom of the Perl Monks concerning the following question:
but when I run it on a file with one word highlighted on each of three pages, it returns 1 for the page number three times. Anyone know what I'm doing wrong?use Win32::OLE::Const 'Microsoft Word'; $filename = "c:\\work\\test.doc"; $word = Win32::OLE->new('Word.Application', 'Quit'); $doc = $word->Documents->Open($filename) or die "Can't open: $!\n"; for(my $i = 1; $i <= $doc->Words->Count; $i++) { if($doc->Words->Item($i)->HighlightColorIndex > 0) { $page = $doc->Words->Item($i)->Application->Selection + ->Information(wdActiveEndPageNumber); print "$page\n"; } }
TIA...Steve
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::OLE: How to get the page number from ms-word?
by NetWallah (Canon) on Mar 25, 2006 at 06:10 UTC | |
by Albannach (Monsignor) on Mar 25, 2006 at 17:53 UTC | |
|
Re: Win32::OLE: How to get the page number from ms-word?
by Madams (Pilgrim) on Mar 26, 2006 at 03:47 UTC |