#读word文档内容
#程序:刘兴
#时间:2010.3.19
#blog:http://deepfuture.iteye.com
#QQ:782322192
use warnings;
use strict;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Word';
my $word = CreateObject Win32::OLE 'Word.Application' or die $!;
$word->{'Visible'} = 1;
my $id=1;
while ($id<20){
my $document = $word->Documents->Open("e:\\text\\2.doc");
my $paragraphs = $document->Paragraphs($id);
my $myrange = $paragraphs->range;
my $myfont= $myrange->Font->Size;
my $text=$myrange->Text;
#$text=encode("gbk", decode("utf-8",$text));
print "$text\n";
print "$myfont\n";
#$myrange
#my $pdffilename = "e:\\text\\$id.pdf";
#$document->saveas({FileName=>$pdffilename,FileFormat=>wdExportFormatPDF});
$id++;
}
#$word->quit();