5
我遇到了問題,當我運行腳本給出錯誤時,無法通過軟件包「Spreadsheet :: WriteExcel」在chart_column.pl第33行找到對象方法「add_chart」。我可以知道問題是什麼這裏?我正在使用爲x86_64-linux構建的perl,v5.8.5。 ! #在/ usr/bin中/ perl的-w使用perl的excel圖表
###############################################################################
#
# A simple demo of Column charts in Spreadsheet::WriteExcel.
#
# reverse('©'), December 2009, John McNamara, [email protected]
#
use strict;
use Spreadsheet::WriteExcel;
my $workbook = Spreadsheet::WriteExcel->new('chart_column.xls');
my $worksheet = $workbook->add_worksheet();
my $bold = $workbook->add_format(bold => 1);
# Add the worksheet data that the charts will refer to.
my $headings = [ 'Category', 'Values 1', 'Values 2' ];
my $data = [
[ 2, 3, 4, 5, 6, 7 ],
[ 1, 4, 5, 2, 1, 5 ],
[ 3, 6, 7, 5, 4, 3 ],
];
$worksheet->write('A1', $headings, $bold);
$worksheet->write('A2', $data);
###############################################################################
#
# Example 1. A minimal chart.
#
my $chart1 = $workbook->add_chart(type => 'column');
# Add values only. Use the default categories.
$chart1->add_series(values => '=Sheet1!$B$2:$B$7');
# Insert the chart into the main worksheet.
$worksheet->insert_chart('E2', $chart1);
如果你不介意在XLSX xls,我推薦[Excel :: Writer :: XLSX](http://search.cpan.org/dist/Excel-Writer-XLSX/)。這是更積極的維護。 – runrig