Thanks for your help. I have written like this using your idea. Thanks again Saran
use Win32::OLE; use Win32::OLE::Enum; print "Name of Word document: ";# input the document name along with t +he location chomp ($doc = <STDIN>); # This is to create document object $document = Win32::OLE -> GetObject("$doc"); #steps used to convert the Word document in to a text file. print "Name of upload file: "; chomp ($upload = <STDIN>) ; open (FH,">$upload"); print "Extracting Text ...$document \n"; $paragraphs = $document->Paragraphs(); $enumerate = new Win32::OLE::Enum($paragraphs); while(defined($paragraph = $enumerate->Next())) { # $style = $paragraph->{Style}->{NameLocal}; # print FH "+$style\n"; $text = $paragraph->{Range}->{Text}; $text =~ s/[\n\r]//g; $text =~ s/\x0b/\n/g; print FH "=$text\n"; } # Steps used to parse the text file and get the required information i +n comma seperated values open (FH,"<$upload"); while (<FH>) { chomp; if (m/Test Script Name/) { $test_case_name = <FH>; chomp $test_case_name; $test_case_name =~ s/\=//; } if (m/Script Description/) { $short_desc = <FH>; chomp $short_desc; $short_desc =~ s/\=//; print "$test_case_name,$short_desc\n"; } } close FH;

20080119 Janitored by Corion: Added formatting, code tags, as per Writeup Formatting Tips


In reply to Re^4: Extracting information from a MS WORD Document by Saran2
in thread Extracting information from a MS WORD Document by Saran2

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.