NAME
Win32::PowerPoint - helps to convert texts to PP slides
SYNOPSIS
use Win32::PowerPoint;
# invoke (or connect to) PowerPoint
my $pp = Win32::PowerPoint->new;
$pp->new_presentation(
background_forecolor => [255,255,255],
background_backcolor => 'RGB(0, 0, 0)',
pattern => 'Shingle',
);
... (load and parse your slide text)
foreach my $slide (@slides) {
$pp->new_slide;
$pp->add_text($slide->title, { size => 40, bold => 1 });
$pp->add_text($slide->body);
$pp->add_text($slide->link, { link => $slide->link });
}
$pp->save_presentation('slide.ppt');
$pp->close_presentation;
# PowerPoint closes automatically
DESCRIPTION
Win32::PowerPoint mainly aims to help to convert Spork (or Sporx) texts to PowerPoint slides. Though there's no converter at the moment, you can add texts to your new slides/presentation and save it.
METHODS
new
Invokes (or connects to) PowerPoint.
connect_or_invoke
Explicitly connects to (or invoke) PowerPoint.
quit
Explicitly disconnects and close PowerPoint this module (or you) invoked.
new_presentation (options)
Creates a new (probably blank) presentation. Options are:
- background_forecolor, background_backcolor
-
You can specify background colors of the slides with an array ref of RGB components ([255, 255, 255] for white) or formatted string ('255, 0, 0' for red). You can use '(0, 255, 255)' or 'RGB(0, 255, 255)' format for clarity. These colors are applied to all the slides you'll add, unless you specify other colors for the slides explicitly.
You can use 'masterbkgforecolor' and 'masterbkgbackcolor' as aliases.
- pattern
-
You also can specify default background pattern for the slides. See Win32::PowerPoint::Constants (or MSDN or PowerPoint's help) for supported pattern names. You can omit 'msoPattern' part and the names are case-sensitive.
save_presentation (path)
Saves the presentation to where you specified. Accepts relative path. You might want to save it as .pps (slideshow) file to make it easy to show slides (it just starts full screen slideshow with doubleclick).
close_presentation
Explicitly closes the presentation.
new_slide (options)
Adds a new (blank) slide to the presentation. Options are:
- background_forecolor, background_backcolor
-
You can set colors just for the slide with these options. You can use 'bkgforecolor' and 'bkgbackcolor' as aliases.
- pattern
-
You also can set background pattern just for the slide.
add_text (text, options)
Adds (formatted) text to the slide. Options are:
See 'decorate_range' for other options.
insert_before (text, options)
insert_after (text, options)
Prepends/Appends text to the current Textbox. See 'decorate_range' for options.
decorate_range (range, options)
Decorates text of the range. Options are:
- bold, italic, underline, shadow, subscript, superscript
-
Boolean.
- size
-
Integer.
- color
-
See above for the convention.
- font
-
Font name of the text. You can use 'name' as an alias.
- alignment
-
One of the 'left' (default), 'center', 'right', 'justify', 'distribute'.
You can use 'align' as an alias.
- link
-
hyperlink address of the Text.
(This method is mainly for the internal use).
IF YOU WANT TO GO INTO DETAIL
This module uses Win32::OLE internally. You can fully control PowerPoint through these accessors.
application
returns Application object.
print $pp->application->Name;
presentation
returns current Presentation object (maybe ActivePresentation but that's not assured).
$pp->save_presentation('sample.ppt') unless $pp->presentation->Saved;
while (my $last = $pp->presentation->Slides->Count) {
$pp->presentation->Slides($last)->Delete;
}
slide
returns current Slide object.
$pp->slide->Export(".\\slide_01.jpg",'jpg');
$pp->slide->Shapes(1)->TextFrame->TextRange
->Characters(1, 5)->Font->{Bold} = $pp->c->True;
c
returns Win32::PowerPoint::Constants object.
AUTHOR
Kenichi Ishigaki, <ishigaki@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2006- by Kenichi Ishigaki
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.