I am trying to add two elements to an existing PowerPoint if a specific term (in my example "transformation" is found: 1) a text object and with a red background (no transparency) and 2) a note/comment. I manage to do 1) but can't find the option to set the background but I fail completely on point 2). Any suggestion?

#!perl use strict; use warnings; use utf8; use Cwd; use Win32::OLE; use Win32::OLE 'CP_UTF8'; use Win32::OLE::Const 'Microsoft PowerPoint'; $Win32::OLE::Warn = 3; $Win32::OLE::CP = CP_UTF8; my $file = "original.pptx"; my $dir = getcwd(); my $filename = $dir . '\\' . $file; print ("Starting PowerPoint\n"); my $process = Win32::OLE->GetActiveObject('Powerpoint.Application') || Win32::OLE->new('Powerpoint.Application', 'Quit'); print ( "Opening '$filename'\n" ); my $ppt = $process->Presentations->Open($filename); $file =~ s/original/TCF6203/; $filename = "$dir/$file"; my @activeslides = $process->ActivePresentation->Slides->in; foreach my $slide (@activeslides) { my $name = $slide->{Name}; foreach my $shape ($slide->Shapes->in){ if ($shape->TextFrame->HasText){ #TO DO: to get all elements I sho +uld create a loop here if ($shape->HasTextFrame){ my $text = $shape->TextFrame->TextRange->Text; print "$name\nText $text = "; if ($text =~ /transformation/){ my $TextBox=$slide->Shapes->AddTextbox({Orientation=>1, Left=>5, Top=>5, Width=>250, Height=>250, }); $TextBox->TextFrame->TextRange->{Text} ="Big Ole Test"; #$slide->NotesPage->TextRange->{Text} ="Big Ole Test"; #CO +MMENT OUT TO TRY TO ADD NOTE/COMMENT print "OK\n"; } else { print "NOTHING TO DO\n"; }; } } } } print ( "Saving '$filename'\n" ); $ppt->SaveAs($filename);

In reply to Add comment to PowerPoint Win32::OLE by IB2017

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.