Thank you for any idea#!/usr/bin/perl use strict; use warnings; use Win32::OLE::Const 'Microsoft Word'; #$Win32::OLE::CP = CP_UTF8; binmode STDOUT, 'encoding(utf8)'; # OPEN FILE SPECIFIED AS FIRST ARGUMENT my $fname=$ARGV[0]; my $fnameFullPath = `cygpath.exe -wa $fname`; $fnameFullPath =~ s/\\/\\\\/g; $fnameFullPath =~ s/\s*$//; unless (-e $fnameFullPath) { print "Error: File did not exists\n"; exi +t 1;} my $Word = Win32::OLE->GetActiveObject('Word.Application') || Win32::OLE->new('Word.Application','Quit') or die Win32::OLE->LastError(); $Word->{'Visible'} = 0; my $doc = $Word->Documents->Open($fnameFullPath); my $paragraphs = $doc->Paragraphs() ; my $enumerate = new Win32::OLE::Enum($paragraphs); while(defined(my $paragraph = $enumerate->Next())) { my $text = $paragraph->{Range}->{Text}; my $sel = $Word->Selection; my $font = $sel->Font; # THIS DOES NOT WORK CORRECTLY BECAUSE $Word->Selection IS SET ONL +Y ONCE (FOR FIRST PARAGRAPH) # IS THERE ANY METHOD HOW TO FORCE Selection TO POINT WHERE ACTUAL + $paragraph IS POINTING ? if ($font->{Size} == 24){ print "Text: ", $text, "\n"; print "Font Bold: ", $font->{Bold}, "\n"; print "Font Italic: ", $font->{Italic}, "\n"; print "Font Name: ", $font->{Name}, "\n"; print "Font Size: ", $font->{Size}, "\n"; # Size('9pt') +; print "=========\n"; } } $Word->ActiveDocument->Close ; $Word->Quit;
In reply to win 32 OLE Selection property by wakatana
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |