/ Published in: Perl
use Object Linking Environment of MS to manupilation office 2003/2007 word file.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/path/to/perl.exe -w # [email protected] @ 2009/7/8 (version according to date) # use Object Linking Environment of MS to manupilation office 2003/2007 word file. use strict; my $VERSION = "2009/07/08"; my $usage = "Usage of Ver: $VERSION: perl ". __FILE__ . " /abstract/path/to/word.doc(x)\n"; if (!%ARGV){ } my $File = $ARGV[0]; my $FileLog = $File . ".txt"; my $argc = @ARGV; if (!$Word->Documents){ } my ($object, $paragraph, $enum); # the whold contents of this Office Word file (*.doc(x)) my @paras = (); $enum = Win32::OLE::Enum->new($Doc->Paragraphs); while(($object = $enum->Next)) { $paragraph = $object->Range->{Text}; next; } $paragraph =~ s/\s//g; +$//g; } $Doc->Close; my $paras_count = @paras; if($paras_count){ foreach my $para (@paras){ } close FILELOG; }else{ }