web 2.0

How to use PHP & PowerPoint - Create Multiple Slides

How to use PHP & PowerPoint - Create Multiple Slides The Learn / Tutorial / Sctipts php programming how to using  PHP Create PowerPoint and Create Multiple Slides

ShotDev Focus:
- PHP  & Create PowerPoint and Create Multiple Slides

Example

php_ppt_multi_slice.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?

//*** Constant ***//
$ppLayoutTitleOnly = 11;

//*** Font Color ***//
$wdColorLightGreen  = "&HCCFFCC";
$wdColorBlue = "&HFF0000";

$ppApp = new COM("PowerPoint.Application");

$strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); //  C:/AppServ/www/myphp
$ppName = "MyPP/MyPPt.ppt";

$ppPres = $ppApp->Presentations->Add();

$ppSlide1 = $ppPres->Slides->Add(1,$ppLayoutTitleOnly);
//*** AddTextbox,  objControl.Left,objControl.Top,objControl.Width,objControl.Height ***//
$ppSlide1->Shapes->AddTextbox(1,50,100,700,100);  //***4
$ppSlide1->Shapes(1)->TextFrame->TextRange->Text = "I Love  ShotDev.Com 1";
$ppSlide1->Shapes(1)->TextFrame->TextRange->Font->Name =  "Arial";
$ppSlide1->Shapes(1)->TextFrame->TextRange->Font->Size =  10;
$ppSlide1->Shapes(1)->TextFrame->TextRange->Font->Color  =  $wdColorLightGreen;

$ppSlide1->Shapes->AddTextbox(1,50,150,700,100);
$ppSlide1->Shapes(2)->TextFrame->TextRange->Text = "I Love  ShotDev.Com 2";
$ppSlide1->Shapes(2)->TextFrame->TextRange->Font->Name =  "Arial";
$ppSlide1->Shapes(2)->TextFrame->TextRange->Font->Size =  20;

$ppSlide1->Shapes->AddTextbox(1,50,200,700,100);
$ppSlide1->Shapes(3)->TextFrame->TextRange->Text = "I Love  ShotDev.Com 3";
$ppSlide1->Shapes(3)->TextFrame->TextRange->Font->Name =  "Arial";
$ppSlide1->Shapes(3)->TextFrame->TextRange->Font->Size =  30;

$ppSlide1->Shapes->AddTextbox(1,50,250,700,100);
$ppSlide1->Shapes(4)->TextFrame->TextRange->Text = "I Love  ShotDev.Com 4";
$ppSlide1->Shapes(4)->TextFrame->TextRange->Font->Name =  "Arial";
$ppSlide1->Shapes(4)->TextFrame->TextRange->Font->Size =  40;

$ppSlide1->Shapes->AddTextbox(1,50,300,700,100);
$ppSlide1->Shapes(5)->TextFrame->TextRange->Text = "I Love  ShotDev.Com 5";
$ppSlide1->Shapes(5)->TextFrame->TextRange->Font->Name =  "Arial";
$ppSlide1->Shapes(5)->TextFrame->TextRange->Font->Size =  50;
$ppSlide1->Shapes(5)->TextFrame->TextRange->Font->Color  =  $wdColorBlue;

$ppSlide1->Shapes->AddPicture(realpath("logo.gif"),0,1,250,330,200,100);    //*** Picture,Left,Top,Width,Height ***//

$ppApp->Presentations[1]->SaveAs($strPath."/".$ppName);
//$ppApp->Presentations[1]->SaveAs(realpath($ppName));

$ppApp->Quit;
$ppApp = null;
?>
PowerPoint Created <a href="<?=$ppName?>">Click  here</a> to Download.
</body>
</html>

Create a php file and save to path root-path/myphp/

Run
http://localhost/myphp/php_ppt_multi_slice.php

Screenshot

PHP & PowerPoint - Create PowerPoint and Create Multiple Slides
.
.
.

Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

Leave a Reply

You must be logged in to post a comment.