in reply to Perl+word
If you search for win32::ole you will find some useful information (for example).
The code would look like this:
This assumes that Word is open with an open document.#!/bin/perl5 use strict; use warnings; use Win32::OLE; my $w = Win32::OLE->GetActiveObject('Word.Application'); my $d = $w->ActiveDocument; my $paras = $d->Paragraphs; foreach my $para ( in $paras ) { my $style = $para->Style->{ NameLocal }; my $text = $para->Range->{ text }; print "$style\t$text\n" }
If you're familiar with VBA methods it is fairly easy to work out the perl syntax. The best reference is the VBA help file.
The win32::ole docs also have some examples.
Hope this helps, wfsp
|
|---|