简体   繁体   English

我如何使用Linux支持中的perl模块从Word女士读取数据

[英]how do i read data from Ms Word document using perl module in linux support

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

Text::Extract::Word looks like it might be a good place to start. Text :: Extract :: Word 似乎是一个不错的起点。 From the synopsis: 从简介:

# 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");

I use OLE for Word, Excel, and Outlook: 我将OLE用于Word,Excel和Outlook:

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;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM