in reply to Re: (Win32::OLE) convert text to word
in thread convert text to word
How can I solve that problem...if anybody know please answer......Can't locate loadable object for module Win32::OLE in @INC (@INC conta +ins: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8. +0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/per +l5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_per +l/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr +/lib/perl5/vendor_perl .) at word2text.pl line 2
use Win32::OLE; # check if Word exists and is running my $word = Win32::OLE->GetActiveObject('Word.Application'); die "Word not Installed" if $@; # start Word program instance if required or die if unable to unless (defined $word) { $word = Win32::OLE->new('Word.Application', sub { $_[0]->Quit; } ) + or die 'Cannot start Word'; } # hide/show the document $word->{Visible} = 0; # Create new document my $d = $word->Documents->Add; # define selection my $s = $word->Selection; #set lines to be written to document my @lines = ( "This is a test line\n", "This is second test Line\n", "This is the third line\n", ); # add the lines of text $s->TypeText($_) for @lines; # save our object $word->WordBasic->FileSaveAs("c:\\test.doc"); # undef our object out of existance undef $word;
janitored by ybiC: Balanced <code> tags around code and error message, as per Monastery convention
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: convert text to word
by BrowserUk (Patriarch) on Feb 06, 2003 at 17:36 UTC |