Re: [問題] 把txt寫入excel的問題
※ 引述《handsomegirl (薰)》之銘言:
: 這是之前問題的延續吧...
: #!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);
^^ 這裡改成2就可以以欄的方式畫圖了
自己試了幾次發現的,雖然不知道為什麼XD
: $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."
怎麼指定x軸與數列的名稱
這就想不出來了....
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.65.55.161
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
Perl 近期熱門文章
PTT數位生活區 即時熱門文章