使用 Win32::OLE 我可以从 word 文档中读取表格、段落。但是我想从word文档中读取图片/图像,有没有获取图片的功能?
下面是表格和段落阅读的代码。
$Word = Win32::OLE->GetActiveObject('Word.Application') || Win32::OLE->new('Word.Application');
$Word->{'Visible'} = 0;
$Word->{DisplayAlerts} = 0;
my $document = $Word->Documents->Open($Req_doc_path);
### for tables reading
my $tables = $document->{'Tables'};
for my $table (in $tables){
my $tableText = $table->ConvertToText({ Separator => wdSeparateByTabs });
#print "Table: ", $tableText->Text(), "\n";
}
### for paragraphs reading
$paragraphs = $document->paragraphs();
$enumerate = new Win32::OLE::Enum($paragraphs);
while(defined($paragraph = $enumerate->Next()))
{
}
#
请帮助我阅读图像/图片。提前致谢。