nicok2 has asked for the wisdom of the Perl Monks concerning the following question:
Here's the way i use to create a slide and add a graph within, using the previously created presentation object:########################################################### # # sub create_ppt_presentation # # create and return a new blank presentation # # $title is title for the presentation # ########################################################### sub create_ppt_presentation { my ($title) = @_; my ($PptApp, $Presentation, $Slide); trace("create_ppt_presentation: getting powerpoint.application obj +ect\n"); $PptApp = Win32::OLE-> GetActiveObject('PowerPoint.Application') || Win32::OLE-> new('PowerPoint.Application', 'Quit'); $PptApp-> {Visible} = IS_PPT_VISIBLE; $Presentation = $PptApp-> Presentations->Add(); return ($PptApp, $Presentation); }
Here's how i get the datasheet:$Slide = $Presentation-> Slides->Add({Index => $position, Layout => pp +LayoutBlank}); $Slide->{Name} = "test"; $graph_shape = $Slide->Shapes->AddOleObject({ Left => 10, Top => 40, Height => 450, Width => 650, ClassName => "MSGraph.Chart", Link => 0}); $graph = $graph_shape->OLEFormat->{Object}; # ms graph chart object # i can now work with $graph
After this, here's how i save the powerpoint presentation.$datasheet = $graph->Application->{DataSheet}; $datasheet->Cells->ClearContents(); # i can now feed the datasheet with some datas # ... # after the settings of the datasheet's cells, free graph and data +sheet undef $datasheet; undef $graph;
If anyone has an idea about this mysterious reset, i'll be sooo glad to hear it :o)# $Presentaion is the powerpoint presentation object $Presentation->SaveAs("c:/test.ppt");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: [Win32::Ole] Ms graph in powerpoint generated file is resetted at edition
by traveler (Parson) on Nov 24, 2004 at 22:11 UTC | |
by nicok2 (Initiate) on Nov 25, 2004 at 09:02 UTC |