我正在尝试使用以下 Perl 代码对 Excel 工作表中的图表进行一些修改:
$ex = Win32::OLE->new ('Excel.Application')
or confess "could not instantiate Excel.Application: $!\n";
my $workbook = $ex->Workbooks->Open ($file)
or confess "failed to open $file: $!";
my $charts_ws = $workbook->Worksheets ("Charts");
my $charts_col = $charts_ws->ChartObjects;
for (my $i = 0; $i != $charts_col->Count; ++$i)
{
my $chart = $charts_col->Item ($i); # XXX the problem is here
}
$workbook->Close;
一切似乎都有效,直到XXX
标记线。不幸的是,我收到以下错误:
Win32::OLE(0.1709) error 0x800a03ec
in METHOD/PROPERTYGET "Item" at test.pl line 557
我无法破译0x800a03ec
HRESULT 值是什么。