Hi List,

 I am opening word document through Win32::OLE and saving as Plain Text with
 Encoding option MS-DOS and Insert-Line-Break option.
 
 I achieved the above output through perl, but output not matching with the
 output which is done the same manual operation in MS-word.

Complete code:

        use Win32::OLE;
        use Win32::OLE::Const 'Microsoft Word';

        my $folderpath=$ARGV[0];

        my $Word = Win32::OLE->new('Word.Application');
        $Word->{'Visible'} = 0;
        $Word->{DisplayAlerts} = 0;
        my $doc = $Word->Documents->Open("$folderpath\\Chapter 1.doc");
        $Word->ActiveDocument->SaveAs({FileName=>"$folderpath\\Chapter
1.txt", FileFormat=>wdFormatTextLineBreaks});
        $Word->{ActiveDocument}->Close;
        $doc->Close;
        $Word->Close;

By manual (In word application) output coming with breaks in each line like:

    Writing, of whatever type, can be a draining and dreaded task.   But it
can also be a passion, 
an adventure, and even a compulsion that occasionally brings great
satisfaction as a payoff to 
the pain.   One group of people write simply because it is demanded of them
by employers (or 
teachers).  A second group set down words because they like to write.  And a
special third 
group may internally be compelled to pen things due to changes in the brain
that Alice Flaherty 
and colleague neurologists label hypergraphia, ?an overpowering desire to
write.? [1]  


[[Line breaks for each line in aparagraph - Required output]]

By perl code output coming with breaks each line like:

    Writing, of whatever type, can be a draining and dreaded task.   But it
can also be a passion, an adventure, and even a compulsion that occasionally
brings great satisfaction as a payoff to the pain.   One group of people
write simply because it is demanded of them by employers (or teachers).  A
second group set down words because they like to write.  And a special third
group may internally be compelled to pen things due to changes in the brain
that Alice Flaherty and colleague neurologists label hypergraphia, "an
overpowering desire to write." [1]  

[[Single line without line break]]

I am using perl5.8.8. basic console perl programming. Please suggest.

Please correct me if I did any mistake on the above code.

Regards,
Ramkumar,



_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to