in reply to Re: Error in Extracting Data from the 1st slide of a ppt
in thread Error in Extracting Data from the 1st slide of a ppt

Hi Poj,

Thanks a lot for your help. This code works great while reading the titles. However, I am also trying to extract the author and the date from the 1st slide. If these values are put in placeholders then the code works fine. However, these are put in a textbox then the line

" my $type = $shape->Placeholderformat->Type; "

gives a type mismatch error. I am assuming thats because a textbox does not count as a placeholder. How do I try to fix that?

  • Comment on Re^2: Error in Extracting Data from the 1st slide of a ppt

Replies are listed 'Best First'.
Re^3: Error in Extracting Data from the 1st slide of a ppt
by poj (Abbot) on Dec 04, 2015 at 20:20 UTC

    Deal with different shape types with if/else statements. (You can use the object browser to inspect the msoShapeType constant values)

    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 $stype = $shape->type; print "Shape type is $stype\n"; if ($stype == 17){ my $text = $shape->TextFrame->TextRange->text; print "TextBox is $text\n"; } elsif ($stype == 14){ 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"; } } } }
    poj