在Windows

时间:2016-02-23 06:58:47

标签: perl win32ole

我使用Win32 :: OLE自动执行将图像插入Word文档的过程。经过一些研究,我包括以下几行:

use Win32::OLE;
use Win32::OLE::Const 'Microsoft.Word';    # wd  constants
use Win32::OLE::Const 'Microsoft Office';  # mso constants

然后,我将子程序包括在内:

sub insert_picture {
my $document = shift;
my $file     = shift;
my $left     = shift;
my $top      = shift;
my $width    = shift;
my $height   = shift;

my $picture = 
  $document-> Shapes -> AddPicture (
  $file, 
  msoFalse, # link to file
  msoTrue,  # save with document
  $left, $top, $width, $height, 
  $document->ActiveWindow->Selection->{Range}
);
  return $picture;
}

当我尝试运行脚本时,我收到如下错误:

在xxx.pl使用“strict subs”时不允许使用Bareword“msoFalse”

在xxx.pl中使用“strict subs”时不允许使用Bareword“msoTrue”

我使用的perl版本是5.14.2,DWIMPerl。

知道这里有什么问题吗?所有评论都非常感谢。

0 个答案:

没有答案