Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The lines#! perl -w use warnings; use strict; use Win32::OLE ; my $excel = Win32::OLE->new('Excel.Application'); $excel->{'Visible'} = 1; my $workbook = $excel -> Workbooks -> Add; my $sheet = $workbook->Sheets("Tabelle1"); $sheet -> Range('A1')->{'Value'} = "Temp [°C]"; $sheet -> Range('B1')->{'Value'} = "Vcc [V]"; $sheet -> Range('C1')->{'Value'} = "Vio [V]"; $sheet -> Range('D1')->{'Value'} = "Ivcc [mA]"; $sheet -> Range('A2:D3')->{'Value'} = [ ['1', '2', '3', '4' ], ['5', '6', '7', '8' ], ]; my $sheet2 = $workbook-> Sheets -> Add; $sheet -> select; #&sheet2->Shapes->AddChart->Select; #ActiveChart->SetSourceData Source->Range("Tabelle4!$A$1:$C$18"); #$workbook->PivotChaches->Add{SourceType=>1,SourceData=>'Tabelle1!Z1S1 +:Z3S4'})->({TableDestination=>'Tabelle4!Z1S1', TableName=>'PivotTable +1'}); my $pivot=$workbook->PivotTableWizard( { SourceType => 1, SourceData => 'Tabelle1!Z1S1:Z3S4', TableDestination => "Tabelle4!Z1S1", TableName => "PivotTable1", HasAutoFormat => 1 }); $pivot->PivotFields("Vcc [V]")->{Orientation} = 1; # 4=xlDataField $pivot->PivotFields("Temp [°C]")->{Orientation} = 2; # 4=xlDataField $pivot->PivotFields("Vio [V]")->{Orientation} = 1; # 4=xlDataField $pivot->PivotFields("Ivcc [mA]")->{Orientation} = 4; # 4=xlDataField $pivot->PivotFields("Summe von Ivcc [mA]")->{Function} = 2; #{Caption} + = "Mittelwert von Ivcc [mA]"; $sheet2->Range('F1')->Select; my $chart=$sheet2->Shapes->AddChart(65); $sheet2->chartObjects("Diagramm 1")->Activate; $chart->{HasTitle} = 1; $chart->ChartTitle->{Text} = "Some Title"; $excel -> Quit;
didn't work. Why?$chart->{HasTitle} = 1; $chart->ChartTitle->{Text} = "Some Title";
Some additional questions:
Where can I find information/documentation on the "Perl excel syntax"?
Can I control excel completely with the WIN32::OLE modul?
Thanks for working on this topic
Best Regards
jazzman
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WIN32::OLE excel pivot Chart Title doesn't work
by Corion (Patriarch) on Feb 22, 2011 at 22:12 UTC | |
by jazzman (Initiate) on Feb 23, 2011 at 05:59 UTC | |
by Corion (Patriarch) on Feb 23, 2011 at 07:47 UTC |