看板 Perl 關於我們 聯絡資訊
這是之前問題的延續吧... #!usr/bin/perl use Win32::OLE qw(in with); use Win32::OLE::Const 'Microsoft Excel'; $Win32::OLE::Warn = 3; # Start Excel and make it visible $xlApp = Win32::OLE->new('Excel.Application'); $xlApp->{Visible} = 1; # Create a new workbook $xlBook = $xlApp->Workbooks->Add; $Excel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE->new('Excel.Application', 'Quit'); $Sheet=$xlBook->Worksheets(1); # Our data that we will add to the workbook... open (file,"c:\\test\\chart\\ATIOFF.txt"); while(chomp($line=<file>)){ $raw++; for $data (split/ /,$line){ $cou++ ; $Sheet->Cells($raw,$cou)->{Value}= $data; } $cou=0; } $xlBook->SaveAs("c:\\test\\chart\\ATIOFF.xls"); close (file); # Write all the data at once... $rng = $xlBook->ActiveSheet->Range("G1:G24"); $chart = $xlBook->Charts->Add; $chart->SetSourceData($rng, 4); $chart->{ChartType} = 4; # 3D-pie chart $chart->Location(1, "Sheet4"); # Wait for user input... print "Press <return> to continue..."; $x = <STDIN>; # Clean up $xlBook->{Saved} = 0; $xlApp->Quit; $xlBook = 0; $xlApp = 0; print "All done." 我把我的檔案寫到了EXCEL裡面 也產生出折線圖 但是我希望以欄為數列畫圖方式 但是這樣跑出來是以列 我想請問哪一行是描述關於選擇列或欄 還有怎麼指定x軸與數列的名稱 目前我只有指定數值的範圍而已 因為關於Perl與Excel相關的資料好少 找了很久都沒有答案~希望高手幫幫忙囉 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.65.55.161
LiloHuang:會學Perl的通常都很少會去碰EXCEL...找到的資料當然少 07/31 18:16
LiloHuang:如果要畫出漂亮的圖表 建議你http://www.advsofteng.com 07/31 18:16
LiloHuang:絕對比EXCEL畫的漂亮而且功能完整 07/31 18:17