The format of the document is:
1. Hi,perl monks.Have a good day.
2. Checking whether the output is coming.Perlmonks.org
3. HTML formatting is good. Use while formatting.
####
first cell :- Hi,perl monks.
Second cell :- Have a good day
Third cell:- Checking whether the output is coming.
fourth cell:- Perlmonks.org
fifth cell :- HTML formatting is good.
sixth cell :- Use while formatting.
####
first cell :- Hi,perl monks. Have a good day
Second cell:- Checking whether the output is coming.perlmonks.org
Third cell :- HTML formatting is good.Use while formatting.
####
@files=glob('*.doc');
foreach my $file (@files)
{
$i=0;$j=0;
my $var;
$var = $filename."$file";
print $var ;
my $document = Win32::OLE -> GetObject("$var");
print "Extracting Text ...\n";
my @array;
my $paragraphs = $document->Paragraphs();
my $enumerate = new Win32::OLE::Enum($paragraphs);
while(my $paragraph = $enumerate->Next())
{
my $text = $paragraph->{Range}->{Text};
$text =~ s/[\n\r\t]//g;
$text =~ s/\x0B/\n/g;
$text =~ s/\x07//g;
chomp $text;
my $Data .= $text;
@array=split(/\.$/,$Data);
foreach my $line( @array)
{
if($line =~ m/^Document/sis/)
{
$i=1;
$j=0;
$Sheet->Cells($row,$col-1)->{'Value'} = $file;
}
if ($i == 1)
{
$j=$j+1;
}
if($line=~ m/$pattern/)
{
$s=0;
}
if ($j > 1 && $s!=0)
{
$Sheet-> Cells($row,$col+6)->{'Value'} = $line ;
$row=$row+1;
}
}
}