in reply to pie chart in powerpoint
Now cleaned up:
use strict; use Win32; use Win32::OLE; use Win32::OLE::Const 'Microsoft PowerPoint'; use Win32::OLE::Const 'Microsoft Excel'; my $ex; eval {$ex = Win32::OLE->GetActiveObject('Powerpoint.Application')}; unless (defined $ex) { $ex = Win32::OLE->new('Powerpoint.Application' ) or die "Oops, cannot start PPT\n"; } $ex->{'Active'} = 1; $ex->{'Visible'} = 1; $ex->Presentations->Add(); my $Presentation = $ex->ActivePresentation; my $Slide = $Presentation->Slides->Add({Index=>1, Layout=>ppLayoutTitl +eOnly}); $Slide->{Name} = "Slide111112"; my $Title=$Slide->Shapes->{Title}; $Title->TextFrame->TextRange->{Text} ="Weekly Analysis - Closing Balan +ce"; my $chart = $Slide->Shapes->AddOLEObject( 50, 50, 500, 500, "MSGraph.C +hart" ); my $graph = $chart->OLEFormat->Object; my $datasheet = $graph->Application->DataSheet; $graph->{'HasLegend'} = 0; $graph->{'ChartType'} = xl3DPie; for( my $row=2; $row<=5; $row++ ) { for( my $col=2; $col<=2; $col++ ) { $datasheet->Cells($row,$col)->{'Value'} = rand(); } } $datasheet->Application->Update;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: pie chart in powerpoint
by Rizwan khan (Initiate) on Apr 19, 2013 at 12:15 UTC |