從excel數據中給出excel數據中繪製條形圖Excel數據:它每週動態變化。我想自動化它。從perl中給出excel數據繪製條形圖
===============================
下面是程序:
- 我在Excel中有示例數據。數據可以是學生在每個科目中獲得的名稱和標記。
我想繪製它的Excel圖表。
#!/usr/local/bin/perl print "Content-type: text/html\n\n"; use strict; use Win32::OLE; use Win32::OLE::Const 'Microsoft Excel'; use Spreadsheet::ParseExcel; use Spreadsheet::ParseExcel::SaveParser; my $parser = new Spreadsheet::ParseExcel::SaveParser; my $workbook = $parser->Parse('Nilu.xls'); my $worksheet1 = $workbook->worksheet('Worksheet1'); $worksheet1->activate(); my ($row_min, $row_max) = $worksheet1->row_range(); my ($col_min, $col_max) = $worksheet1->col_range(); print "row min:$row_min row_max:$row_max col_max:$col_max\n\n"; my $worksheet2 = my $parser->add_worksheet('Worksheet2'); #$parser->add_worksheet('Worksheet2');
$ worksheet2-> activate();
# Create a new chart object. In this case an embedded chart. my $chart1 = $workbook->add_chart(type => 'column', embedded => 1); # Configure the first series.
chart1- $> add_series( 名=> '!= Sheet 1中$ B $ 1', 類=> 「!= Sheet 1中\ $ A \ $ 2:\ $ A:$ row_max」, 值=>「= Sheet1!\ $ B \ $ 2:\ $ B:$ row_max」, );
# Set an Excel chart style. Blue colors with white outline and shadow. $chart1->set_style(11); # Insert the chart into the worksheet (with an offset). $worksheet2->insert_chart('F2', $chart1, 25, 10); # Write over the existing file or write a new file. $parser -> SaveAs('Nilu1.xls');
你的問題是什麼? – melpomene
-1:沒問題,沒有明顯的努力。請參閱[如何提問](http://stackoverflow.com/questions/how-to-ask)。 – mpe
我再次更新了代碼的信息... Kindly advice .. – user1855512