Learning & Integrating web technology and code help directory

How to use PHP & PowerPoint - AddTextbox

No comments
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
  1. <html>  
  2. <head>  
  3. <title>ShotDev.Com Tutorial</title>  
  4. </head>  
  5. <body>  
  6. <?  
  7. //*** Constant ***//  
  8. $ppLayoutBlank = 12;  
  9. $ppLayoutChart = 8;  
  10. $ppLayoutChartAndText = 6;  
  11. $ppLayoutClipartAndText = 10;  
  12. $ppLayoutClipArtAndVerticalText = 26;  
  13. $ppLayoutFourObjects = 24;  
  14. $ppLayoutLargeObject = 15;  
  15. $ppLayoutMediaClipAndText = 18;  
  16. $ppLayoutMixed = -2;  
  17. $ppLayoutObject = 16;  
  18. $ppLayoutObjectAndText = 14;  
  19. $ppLayoutObjectAndTwoObjects = 30;  
  20. $ppLayoutObjectOverText = 19;  
  21. $ppLayoutOrgchart = 7;  
  22. $ppLayoutTable = 4;  
  23. $ppLayoutText = 2;  
  24. $ppLayoutTextAndChart = 5;  
  25. $ppLayoutTextAndClipart = 9;  
  26. $ppLayoutTextAndMediaClip = 17;  
  27. $ppLayoutTextAndObject = 13;  
  28. $ppLayoutTextAndTwoObjects = 21;  
  29. $ppLayoutTextOverObject = 20;  
  30. $ppLayoutTitle = 1;  
  31. $ppLayoutTitleOnly = 11;  
  32. $ppLayoutTwoColumnText = 3;  
  33. $ppLayoutTwoObjects = 29;  
  34. $ppLayoutTwoObjectsAndObject = 31;  
  35. $ppLayoutTwoObjectsAndText = 22;  
  36. $ppLayoutTwoObjectsOverText = 23;  
  37. $ppLayoutVerticalText = 25;  
  38. $ppLayoutVerticalTitleAndText = 27;  
  39. $ppLayoutVerticalTitleAndTextOverChart = 28;  
  40.   
  41. $ppApp = new COM("PowerPoint.Application");  
  42.   
  43. $strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); // C:/AppServ/www/myphp  
  44. $ppName = "MyPP/MyPPt.ppt";  
  45.   
  46. $ppPres = $ppApp->Presentations->Add();  
  47.   
  48. $ppSlide1 = $ppPres->Slides->Add(1,$ppLayoutTitleOnly);  
  49. //*** AddTextbox, objControl.Left,objControl.Top,objControl.Width,objControl.Height ***//  
  50. $ppSlide1->Shapes->AddTextbox(1,50,100,700,100);  //***4  
  51. $ppSlide1->Shapes(1)->TextFrame->TextRange->Text = "I Love ShotDev.Com 1";  
  52.   
  53. $ppSlide1->Shapes->AddTextbox(1,50,150,700,100);  
  54. $ppSlide1->Shapes(2)->TextFrame->TextRange->Text = "I Love ShotDev.Com 2";  
  55.   
  56. $ppSlide1->Shapes->AddTextbox(1,50,200,700,100);  
  57. $ppSlide1->Shapes(3)->TextFrame->TextRange->Text = "I Love ShotDev.Com 3";  
  58.   
  59. $ppSlide1->Shapes->AddTextbox(1,50,250,700,100);  
  60. $ppSlide1->Shapes(4)->TextFrame->TextRange->Text = "I Love ShotDev.Com 4";  
  61.   
  62. $ppSlide1->Shapes->AddTextbox(1,50,300,700,100);  
  63. $ppSlide1->Shapes(5)->TextFrame->TextRange->Text = "I Love ShotDev.Com 5";  
  64.   
  65. $ppApp->Presentations[1]->SaveAs($strPath."/".$ppName);  
  66. //$ppApp->Presentations[1]->SaveAs(realpath($ppName));  
  67.   
  68. $ppApp->Quit;  
  69. $ppApp = null;  
  70.   
  71. ?>  
  72. PowerPoint Created <a href="<?=$ppName?>">Click here</a> to Download.  
  73. </body>  
  74. </html>  
Create a php file and save to path root-path/myphp/
Screenshot
PHP & PowerPoint - Create PowerPoint and AddTextbox
.
.

No comments :

Post a Comment