如何在linux支持下使用perl模块从Ms Word文档中读取数据

如何在linux支持下使用perl模块从Ms Word文档中读取数据,perl,module,ms-word,Perl,Module,Ms Word,如何使用linux支持中的Perl模块从MS Word文档中读取数据 # object-based interface use Text::Extract::Word; my $file = Text::Extract::Word->new("test1.doc"); my $text = $file->get_text(); my $body = $file->get_body(); my $footnotes = $file->get_footnotes(); my

如何使用linux支持中的Perl模块从MS Word文档中读取数据

# object-based interface
use Text::Extract::Word;
my $file = Text::Extract::Word->new("test1.doc");
my $text = $file->get_text();
my $body = $file->get_body();
my $footnotes = $file->get_footnotes();
my $headers = $file->get_headers();
my $annotations = $file->get_annotations();
my $bookmarks = $file->get_bookmarks();

# specify :raw if you don't want the text cleaned
my $raw = $file->get_text(':raw');

# legacy interface
use Text::Extract::Word qw(get_all_text);
my $text = get_all_text("test1.doc");

我对Word、Excel和Outlook使用OLE:

require Win32::OLE;
$docfile = "C:\\something.doc";
$Word = Win32::OLE->GetActiveObject('Word.Application');
unless ($Word) { $Word = Win32::OLE->new('Word.Application', sub {$_[0]->Quit;}) or die "oops\n"; }
$Word->{visible} = 1;
my $File = $Word->Documents->Open($docfile);
$File->PrintOut();
$File->Close(); 
$Word->Quit();
undef $File;
undef $Word;

OP要求提供“linux支持”(?)。linux上的Win32::OLE不受支持。快速问题:为什么要使用
$File->PrintOut()
?那不是在打印文件吗?