Hello everyone. I am attempting to write a PERL script that will open a .doc file and parse it based on certain criteria. So far I am able to open the document, split it up into paragraphs, and write each paragraph to a file using the code below. My problem is that within the paragraph there are portions that are bolded and/or italicized and I want to flag those somehow. I can't figure that part out. I have no experience with VB so the MS Word help files didn't help me very much. I'm really drowning here, someone please help! Thanks in advance.
My Code:
use Win32::OLE;
use Win32::OLE::Enum;
$document = Win32::OLE->GetObject("file.doc") or die;
open (FH,">output.txt");
$paragraphs = $document->Paragraphs();
$enumerate = new Win32::OLE::Enum($paragraphs);
while(defined($paragraph = $enumerate->Next()))
{
$text = $paragraph->{Range}->{Text};
$text =~ s/[\n\r]//g;
$text =~ s/\x0b/\n/g;
print FH "$text\n\n":
}
My Code:
use Win32::OLE;
use Win32::OLE::Enum;
$document = Win32::OLE->GetObject("file.doc") or die;
open (FH,">output.txt");
$paragraphs = $document->Paragraphs();
$enumerate = new Win32::OLE::Enum($paragraphs);
while(defined($paragraph = $enumerate->Next()))
{
$text = $paragraph->{Range}->{Text};
$text =~ s/[\n\r]//g;
$text =~ s/\x0b/\n/g;
print FH "$text\n\n":
}