#! 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=>'PivotTable1'}); 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; #### $chart->{HasTitle} = 1; $chart->ChartTitle->{Text} = "Some Title";