I've found few complete and worthwhile perl programs to generate complicated Office files, Word, Excel, and Powerpoint. I've seen many an answer lead the programmer from trying this. It works. I have extensive Word and Excel programs too large for snippets. I am just now toying in Powerpoint and have already gotten further than any post I have found so I'm adding my two cents. Comments were removed for brevity. I'm not a perl guru and I'm sure there may be other ways to do this. Kenneth.Tomiak@AttGlobal.net
use strict ; $DOS::Filename = "d:\\Temp\\Perl2PowerPoint.ppt" ; use Win32::OLE::Const 'Microsoft PowerPoint'; use Win32::Process ; # Launch a Windows program $Win32::OLE::Warn = 2 ; # return errors... if (-f $DOS::Filename) { unlink $DOS::Filename ; } eval {$MS::PowerPoint = Win32::OLE->GetActiveObject('PowerPoint.Appl +ication')} ; die "PowerPoint not installed" if $@ ; unless (defined $MS::PowerPoint) { $MS::PowerPoint = Win32::OLE->new('PowerPoint.Application', sub {$ +_[0]->Quit;}) or die "Oops, cannot start PowerPoint" ; } $MS::PowerPoint->{'Visible'} = 1 ; # 0 = do not show it $ppt::presentation = $MS::PowerPoint->Presentations->Add() ; $ppt::Slide = $ppt::presentation->Slides->Add({Index=>1 , Layout=>pp +LayoutText}); $ppt::Slide->{Name} = "Slide1"; $ppt::presentation->ApplyTemplate('D:\Program Files\Microsoft Office +\Templates\Presentation Designs\high voltage.pot') ; $ppt::slide = $ppt::presentation->Slides->Add({Index=>2 , Layout=>p +pLayoutText}); $ppt::slide->{Name} = "Ken"; $slide::textbox=$ppt::slide->Shapes->AddTextbox({Orientation=>1, Left=>5, Top=>5, Width=>250, Height=>250,}); $slide::textbox->TextFrame->TextRange->{Text} ="Big Ole Test"; $slide::title=$ppt::slide->Shapes->{Title}; $slide::title->TextFrame->TextRange->{Text} ="Title Test"; $ppt::slide = $ppt::slide->Duplicate(); $ppt::slide->{Name} = "Slide2"; $slide::title=$ppt::slide->Shapes->{Title}; $slide::title->TextFrame->TextRange->{Text} ="Slide Test"; $ppt::presentation->SaveAs( \$DOS::Filename ) ; $ppt::presentation->Close; undef $ppt::presentation ; undef $MS::PowerPoint ;

In reply to perl can create Office files from Windows by Anonymous Monk

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.