web 2.0

How to use PHP & PowerPoint - Open Template Modify/Edit Slides

How to use PHP & PowerPoint - Open Template Modify/Edit Slides The Learn / Tutorial / Sctipts php programming how to using  PHP Create PowerPoint and Open Template Modify/Edit Slides

ShotDev Focus:
- PHP  & Create PowerPoint and Open Template Modify/Edit Slides

PHP & PowerPoint - Create PowerPoint and Open Template  Modify/Edit Slides

Example

php_ppt_open.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
//*** Font Color ***//
$wdColorLightGreen  = "&HCCFFCC";
$wdColorBlue = "&HFF0000";

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

$strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); // C:/AppServ/www/myphp
$ppApp->Visible = True;

$ppDoc = "shotdev.ppt";
$ppName = "MyPP/MyPPt.ppt";

$ppPres = $ppApp->Presentations->Open(realpath($ppDoc));

$ppSlide1 = $ppPres->Slides(1);
//*** 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,310,380,100,100);   //*** Picture,Left,Top,Width,Height ***//

$ppSlide2 = $ppPres->Slides->Add(2,3);
$ppSlide2->Shapes(1)->TextFrame->TextRange->Text = "www.ShotDev.Com Version";
$ppSlide2->Shapes(2)->TextFrame->TextRange->Text = "Version 2009".chr(13)."Version 2009".chr(13).
"Version 2009".chr(13)."Version 2009";
$ppSlide2->Shapes(3)->TextFrame->TextRange->Text = "Version 2010".chr(13)."Version 2010".chr(13).
"Version 2010".chr(13)."Version 2010";

$ppSlide3 = $ppPres->Slides->Add(3,4);
$ppSlide3->Shapes(1)->TextFrame->TextRange->Text = "We Love ShotDev.Com";

$ppSlide4 = $ppPres->Slides->Add(4,5);
$ppSlide4->Shapes(1)->TextFrame->TextRange->Text = "We Love ShotDev.Com";
$ppSlide4->Shapes(2)->TextFrame->TextRange->Text = "2006".chr(13)."2007".chr(13)."2008".chr(13)."2009".chr(13)."2010";

$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_open.php

Screenshot

PHP & PowerPoint - Create PowerPoint and Open Template Modify/Edit 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.