web 2.0

How to use PHP & PowerPoint - AddTextbox

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

ShotDev Focus:
- PHP  & Create PowerPoint and AddTextbox

Example

php_ppt_textbox.php


<html>
<head>
<title>ShotDev.Com Tutorial</title>
</head>
<body>
<?
//*** Constant ***//
$ppLayoutBlank = 12;
$ppLayoutChart = 8;
$ppLayoutChartAndText = 6;
$ppLayoutClipartAndText = 10;
$ppLayoutClipArtAndVerticalText = 26;
$ppLayoutFourObjects = 24;
$ppLayoutLargeObject = 15;
$ppLayoutMediaClipAndText = 18;
$ppLayoutMixed = -2;
$ppLayoutObject = 16;
$ppLayoutObjectAndText = 14;
$ppLayoutObjectAndTwoObjects = 30;
$ppLayoutObjectOverText = 19;
$ppLayoutOrgchart = 7;
$ppLayoutTable = 4;
$ppLayoutText = 2;
$ppLayoutTextAndChart = 5;
$ppLayoutTextAndClipart = 9;
$ppLayoutTextAndMediaClip = 17;
$ppLayoutTextAndObject = 13;
$ppLayoutTextAndTwoObjects = 21;
$ppLayoutTextOverObject = 20;
$ppLayoutTitle = 1;
$ppLayoutTitleOnly = 11;
$ppLayoutTwoColumnText = 3;
$ppLayoutTwoObjects = 29;
$ppLayoutTwoObjectsAndObject = 31;
$ppLayoutTwoObjectsAndText = 22;
$ppLayoutTwoObjectsOverText = 23;
$ppLayoutVerticalText = 25;
$ppLayoutVerticalTitleAndText = 27;
$ppLayoutVerticalTitleAndTextOverChart = 28;

$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->AddTextbox(1,50,150,700,100);
$ppSlide1->Shapes(2)->TextFrame->TextRange->Text = "I Love ShotDev.Com 2";

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

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

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

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

Screenshot

PHP & PowerPoint - Create PowerPoint and AddTextbox
.
.
.

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.