我是 Perl 的新手,想使用 Excel 绘制图表。我找到了一些代码,但是当我尝试执行它时,它只在命令提示符上显示“按任意键继续...”。该代码可由其他人执行。我还尝试下载 Excel 编写器包并将它们放在 lib 文件夹中,但它根本没有执行。发现代码绝对可执行。
#!/usr/bin/perl
use strict;
use warnings;
use Excel::Writer::XLSX;
my $workbook = Excel::Writer::XLSX->new('chart.xlsx');
my $worksheet = $workbook->add_worksheet();
# Add the worksheet data the chart refers to.
my $data = [
['Category', 2, 3, 4, 5, 6, 7],
['Value', 1, 4, 5, 2, 1, 5],
];
$worksheet->write('A1', $data);
# Add a worksheet chart.
my $chart = $workbook->add_chart(type => 'column');
# Configure the chart.
$chart->add_series(
categories => '=Sheet1!$A$2:$A$7',
values => '=Sheet1!$B$2:$B$7',
);
__END__
有谁有想法吗?