Hi.
Ramkumar wrote:
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;
When dealing with driving MS Office products through OLE, you're almost
always better off running the package (Word in this case), Going to
Tools/Macro/Start Macro, doing what you want through the GUI, Stopping,
then editing the macro.
This is what I see for Word 2003:
ActiveDocument.SaveAs FileName:= _
This is a test of the linefeeds test output.txt, FileFormat:= _
wdFormatText, LockComments:=False, Password:=,
AddToRecentFiles:=True, _
WritePassword:=, ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False,
SaveAsAOCELetter:= _
False, Encoding:=437, InsertLineBreaks:=True,
AllowSubstitutions:=False, _
LineEnding:=wdCRLF
Perhaps options FileFormat = wdFormatText, InsertLineBreaks = True,
LineEnding = wdCRLF
will do what you want?
___
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs