$data[0]='162|There is a Project Management office in place that monit
+ors, participates and reports on projects|7|0';
$data[1]='163|There is a PMO that provides policies/procedures/tools f
+or project planning/tracking, which are used regularly|0|0';
$data[2]='164|There is no PMO, however, formal policies/procedures/too
+ls exist are used regularly|46|0';
$data[3]='165|Formal policies/procedures/tools exist but are not used|
+0|0';
$data[4]='166|Ad hoc, no formal policies/procedures|46|1';
$qid=65;
$binst=10;
$cname='Client Name';
use Win32::OLE qw(in with);
use Win32::OLE::Const 'Microsoft Excel';
use Win32::OLE::Variant;
$Win32::OLE::Warn = 3;
$Excel = Win32::OLE->new('Excel.Application') or die "oops\n";
my $Book = $Excel->Workbooks->Open("c:\\stage\\scratch.xls");
my $Sheet = $Book->Worksheets("data");
# skip empty cells
$row=1;
$col=1;
$x=0;
$y=1;
for (@data){
$x++;
($id,$label,$value,$checked)=split(/\|/);
$Sheet->Cells($row,$col)->{'Value'}=$label;
$Sheet->Cells($row,$col+1)->{'Value'}=$value;
$Sheet->Cells($row,$col+2)->{'Value'}=$checked;
if($checked==1){
$y=$x;
}
$row++;
}
my $Range = $Sheet->Range("A1:B5");
my $Chart = $Book->Charts->Add;
$Chart->ChartWizard($Range,xlPie,6,xlColumns,1,0,1,"Approach to Projec
+t Management");
$text=$Chart->SeriesCollection(1)->Points(1)->DataLabel->{Text};
$Chart->SeriesCollection(1)->Points($y)->DataLabel->{Text} = "$cname\n
+$text";
$Chart->Legend->{Position} = xlLegendPositionBottom;
$Book->Close;
It is a test for creating multiple graphs in Excel.
Any ideas on the syntax?
|