Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-20 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found