in reply to Error in Extracting Data from the 1st slide of a ppt
Try this cut down version of your code
poj#!perl use strict; use warnings; use Win32::OLE; use Win32::OLE::Const 'Microsoft PowerPoint'; use Win32::OLE::Enum; use File::Find; use Cwd; my $ppt = Win32::OLE->new( 'PowerPoint.Application', sub { $_[0]->Quit + } ) or die "Cannot start PowerPoint: ".Win32::OLE->LastError; find(\&wanted, cwd()); sub wanted { return unless (/pptx?$/); scan($File::Find::name); } sub scan { my $file = shift; print "Scanning $file\n"; my $p = $ppt->Presentations->Open($file); my $slides = Win32::OLE::Enum->new( $p->Slides ); my $slide = $slides->Next; my $shapes = Win32::OLE::Enum->new( $slide->Shapes ); while ( my $shape = $shapes->Next ){ my $type = $shape->PlaceholderFormat->Type; if ( $type == ppPlaceholderTitle or $type == ppPlaceholderCenterTitle or $type == ppPlaceholderVerticalTitle){ my $title = $shape->TextFrame->TextRange->text; print "Title is $title\n"; } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Error in Extracting Data from the 1st slide of a ppt
by mehtav (Initiate) on Dec 04, 2015 at 18:03 UTC | |
by poj (Abbot) on Dec 04, 2015 at 20:20 UTC |