How to use PHP & PowerPoint - Font Style The Learn / Tutorial / Sctipts php programming how to using PHP Create PowerPoint and Font/Style
ShotDev Focus:
- PHP & Create PowerPoint and Font/Style
Example
php_ppt_style.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; //*** 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; $ppApp->Presentations[1]->SaveAs($strPath."/".$ppName); //$ppApp->Presentations[1]->SaveAs(realpath($ppName)); $ppApp->Quit; $ppApp = null; //*** Font Color ***// //$Const wdColorAqua = "&HCCCC33"; //$Const wdColorAutomatic = "&HFF000000"; //$Const wdColorBlack = "&H0"; //$Const wdColorBlue = "&HFF0000"; //$Const wdColorBlueGray = "&H996666"; //$Const wdColorBrightGreen = "&HFF00"; //$Const wdColorBrown = "&H3399"; //$Const wdColorDarkBlue = "&H800000"; //$Const wdColorDarkGreen = "&H3300"; //$Const wdColorDarkRed = "&H80"; //$Const wdColorDarkTeal = "&H663300"; //$Const wdColorDarkYellow = "&H8080"; //$Const wdColorGold = "&HCCFF"; //$Const wdColorGray05 = "&HF3F3F3"; //$Const wdColorGray10 = "&HE6E6E6"; //$Const wdColorGray125 = "&HE0E0E0"; //$Const wdColorGray15 = "&HD9D9D9"; //$Const wdColorGray20 = "&HCCCCCC"; //$Const wdColorGray25 = "&HC0C0C0"; //$Const wdColorGray30 = "&HB3B3B3"; //$Const wdColorGray35 = "&HA6A6A6"; //$Const wdColorGray375 = "&HA0A0A0"; //$Const wdColorGray40 = "&H999999"; //$Const wdColorGray45 = "&H8C8C8C"; //$Const wdColorGray50 = "&H808080"; //$Const wdColorGray55 = "&H737373"; //$Const wdColorGray60 = "&H666666"; //$Const wdColorGray625 = "&H606060"; //$Const wdColorGray65 = "&H595959"; //$Const wdColorGray70 = "&H4C4C4C"; //$Const wdColorGray75 = "&H404040"; //$Const wdColorGray80 = "&H333333"; //$Const wdColorGray85 = "&H262626"; //$Const wdColorGray875 = "&H202020"; //$Const wdColorGray90 = "&H191919"; //$Const wdColorGray95 = "&HC0C0C"; //$Const wdColorGreen = "&H8000"; //$Const wdColorIndigo = "&H993333"; //$Const wdColorLavender = "&HFF99CC"; //$Const wdColorLightBlue = "&HFF6633"; //$Const wdColorLightGreen = "&HCCFFCC"; //$Const wdColorLightOrange = "&H99FF"; //$Const wdColorLightTurquoise = "&HFFFFCC"; //$Const wdColorLightYellow = "&H99FFFF"; //$Const wdColorLime = "&HCC99"; //$Const wdColorOliveGreen = "&H3333"; //$Const wdColorOrange = "&H66FF"; //$Const wdColorPaleBlue = "&HFFCC99"; //$Const wdColorPink = "&HFF00FF"; //$Const wdColorPlum = "&H663399"; //$Const wdColorRed = "&HFF"; //$Const wdColorRose = "&HCC99FF"; //$Const wdColorSeaGreen = "&H669933"; //$Const wdColorSkyBlue = "&HFFCC00"; //$Const wdColorTan = "&H99CCFF"; //$Const wdColorTeal = "&H808000"; //$Const wdColorTurquoise = "&HFFFF00"; //$Const wdColorViolet = "&H800080"; //$Const wdColorWhite = "&HFFFFFF"; //$Const wdColorYellow = "&HFFFF"; ?> 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_style.php
Screenshot