Learning & Integrating web technology and code help directory

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

No comments
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

  1. <html>  
  2. <head>  
  3. <title>ShotDev.Com Tutorial</title>  
  4. </head>  
  5. <body>  
  6. <?  
  7. //*** Font Color ***//  
  8. $wdColorLightGreen  = "&HCCFFCC";  
  9. $wdColorBlue = "&HFF0000";  
  10.   
  11. $ppApp = new COM("PowerPoint.Application");  
  12.   
  13. $strPath = realpath(basename(getenv($_SERVER["SCRIPT_NAME"]))); // C:/AppServ/www/myphp  
  14. $ppApp->Visible = True;  
  15.   
  16. $ppDoc = "shotdev.ppt";  
  17. $ppName = "MyPP/MyPPt.ppt";  
  18.   
  19. $ppPres = $ppApp->Presentations->Open(realpath($ppDoc));  
  20.   
  21. $ppSlide1 = $ppPres->Slides(1);  
  22. //*** AddTextbox, objControl.Left,objControl.Top,objControl.Width,objControl.Height ***//  
  23. $ppSlide1->Shapes->AddTextbox(1,50,100,700,100);  //***4  
  24. $ppSlide1->Shapes(1)->TextFrame->TextRange->Text = "I Love ShotDev.Com 1";  
  25. $ppSlide1->Shapes(1)->TextFrame->TextRange->Font->Name = "Arial";  
  26. $ppSlide1->Shapes(1)->TextFrame->TextRange->Font->Size = 10;  
  27. $ppSlide1->Shapes(1)->TextFrame->TextRange->Font->Color  = $wdColorLightGreen;  
  28.   
  29. $ppSlide1->Shapes->AddTextbox(1,50,150,700,100);  
  30. $ppSlide1->Shapes(2)->TextFrame->TextRange->Text = "I Love ShotDev.Com 2";  
  31. $ppSlide1->Shapes(2)->TextFrame->TextRange->Font->Name = "Arial";  
  32. $ppSlide1->Shapes(2)->TextFrame->TextRange->Font->Size = 20;  
  33.   
  34. $ppSlide1->Shapes->AddTextbox(1,50,200,700,100);  
  35. $ppSlide1->Shapes(3)->TextFrame->TextRange->Text = "I Love ShotDev.Com 3";  
  36. $ppSlide1->Shapes(3)->TextFrame->TextRange->Font->Name = "Arial";  
  37. $ppSlide1->Shapes(3)->TextFrame->TextRange->Font->Size = 30;  
  38.   
  39. $ppSlide1->Shapes->AddTextbox(1,50,250,700,100);  
  40. $ppSlide1->Shapes(4)->TextFrame->TextRange->Text = "I Love ShotDev.Com 4";  
  41. $ppSlide1->Shapes(4)->TextFrame->TextRange->Font->Name = "Arial";  
  42. $ppSlide1->Shapes(4)->TextFrame->TextRange->Font->Size = 40;  
  43.   
  44. $ppSlide1->Shapes->AddTextbox(1,50,300,700,100);  
  45. $ppSlide1->Shapes(5)->TextFrame->TextRange->Text = "I Love ShotDev.Com 5";  
  46. $ppSlide1->Shapes(5)->TextFrame->TextRange->Font->Name = "Arial";  
  47. $ppSlide1->Shapes(5)->TextFrame->TextRange->Font->Size = 50;  
  48. $ppSlide1->Shapes(5)->TextFrame->TextRange->Font->Color  = $wdColorBlue;  
  49.   
  50. $ppSlide1->Shapes->AddPicture(realpath("logo.gif"),0,1,310,380,100,100);   //*** Picture,Left,Top,Width,Height ***//  
  51.   
  52. $ppSlide2 = $ppPres->Slides->Add(2,3);  
  53. $ppSlide2->Shapes(1)->TextFrame->TextRange->Text = "www.ShotDev.Com Version";  
  54. $ppSlide2->Shapes(2)->TextFrame->TextRange->Text = "Version 2009".chr(13)."Version 2009".chr(13).  
  55. "Version 2009".chr(13)."Version 2009";  
  56. $ppSlide2->Shapes(3)->TextFrame->TextRange->Text = "Version 2010".chr(13)."Version 2010".chr(13).  
  57. "Version 2010".chr(13)."Version 2010";  
  58.   
  59. $ppSlide3 = $ppPres->Slides->Add(3,4);  
  60. $ppSlide3->Shapes(1)->TextFrame->TextRange->Text = "We Love ShotDev.Com";  
  61.   
  62. $ppSlide4 = $ppPres->Slides->Add(4,5);  
  63. $ppSlide4->Shapes(1)->TextFrame->TextRange->Text = "We Love ShotDev.Com";  
  64. $ppSlide4->Shapes(2)->TextFrame->TextRange->Text = "2006".chr(13)."2007".chr(13)."2008".chr(13)."2009".chr(13)."2010";  
  65.   
  66. $ppApp->Presentations[1]->SaveAs($strPath."/".$ppName);  
  67. //$ppApp->Presentations[1]->SaveAs(realpath($ppName));  
  68.   
  69. $ppApp->Quit;  
  70. $ppApp = null;  
  71.   
  72. ?>  
  73. PowerPoint Created <a href="<?=$ppName?>">Click here</a> to Download.  
  74.   
  75. </body>  
  76. </html>  
Create a php file and save to path root-path/myphp/
Screenshot
PHP & PowerPoint - Create PowerPoint and Open Template Modify/Edit Slides
.
.

No comments :

Post a Comment