If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > CREATE a POWERPOINT File using PHP COM on FLY

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-05-06, 04:09
Saravanan.R Saravanan.R is offline
Registered User
 
Join Date: Feb 2004
Location: India
Posts: 135
CREATE a POWERPOINT File using PHP COM on FLY

Hi ALL,

I need more info about methods and properties which is to insert a TEXT in TEXT BOX for Powerpoint Slides, and i have to change the background image, FONT, SIZE, Etc... for my Powerpoint Slides on FLY.

I have displays the code below.
Code:
<?php
$powerpnt = new COM("powerpoint.application");
//Creating a new presentation
$pres=$powerpnt->Presentations->Add();
//Adds the first slide. "12" means blank slide
$pres->Slides->Add(1,12);
//Adds another slide. "10" means a slide with a clipart and text
$pres->Slides->Add(2,10);
//Adds a textbox (1=horizontal, 20=left margin, 50=top margin, 300=width, 40=height)
$pres->Slides[1]->Shapes->AddTextbox(1,20,50,300,40);
//Adds a 16-point star (94=16 point star, 100=left margin, 200=top margin, 300=width, 300=height)
$pres->Slides[1]->Shapes->AddShape(94,100,200,300,300);
//Save the document as PPT file
$powerpnt->Presentations[1]->SaveAs("D:\byeworld.ppt");
//And of course, quit Power Point
$powerpnt->quit();
//Give the user a download link
echo '<a href="byeworld.ppt">Download file as .ppt</a>';
?>
Thanks in advance.


awaiting for earlies reply.

Saravanan.R
Reply With Quote
  #2 (permalink)  
Old 12-05-06, 04:13
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
WWGS (what would google say)
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #3 (permalink)  
Old 12-05-06, 04:20
Saravanan.R Saravanan.R is offline
Registered User
 
Join Date: Feb 2004
Location: India
Posts: 135
i didn't get any help in this regard, rather than that code i have posted in this THREAD.
Reply With Quote
  #4 (permalink)  
Old 12-05-06, 05:02
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
PHP by definiton knows nothing at all about Powerpoint, to set anything within Powerpoint you need to know details of the powerpoint API. Once you know (part or all of) the powerpoint API then you can make the appropriate settings using the Powerpoint object you first cretaed as $powerpnt = new COM("powerpoint.application");

You need to use the the methods with that API to make what ever changes you wish

So, in my view, doing a google is avery good first step, unless you happen to have the the Powerpoint documentation in front of you.

Failing that you could try opening a VBA application (either Access or Excel and create a Powerpoint object int heri and by using intellisense find out what you need.

Failing that you could buy a book on controlling Powerpoint programatically.

and icidentally I looked at one or two of the references that that Google search provided and they seem to do, or get very close to, waht you want to achieve
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #5 (permalink)  
Old 12-05-06, 05:49
Saravanan.R Saravanan.R is offline
Registered User
 
Join Date: Feb 2004
Location: India
Posts: 135
Thumbs up

Thanks healdem

I got an VBA powerpoint reference manual. But they r given in based on VB. From that If i use the same methods i cant able to create or insert a TEXT.
For Ex. In VBA-PowerPoint to add a TExt in a Slide as Follows
Code:
Set myDocument = ActivePresentation.Slides(1)
myDocument.Shapes.AddTextbox(Type:=msoTextOrientationHorizontal, _
    Left:=100, Top:=100, Width:=200, Height:=50).TextFrame _
    .TextRange.Text = "Test Box"
How could i change this into my PHP format. I have done partly to create textbox as Follows
Code:
$powerpnt = new COM("powerpoint.application");
//Creating a new presentation
$pres=$powerpnt->Presentations->Add();
//Adds the first slide. "12" means blank slide
$pres->Slides->Add(1,12);
//Adds another slide. "10" means a slide with a clipart and text
$pres->Slides->Add(2,10);
//Adds a textbox (1=horizontal, 20=left margin, 50=top margin, 300=width, 40=height)
$pres->Slides[1]->Shapes->AddTextbox(1,20,50,300,40);
Assist me in this regard
Reply With Quote
  #6 (permalink)  
Old 12-05-06, 06:03
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
I dont know... Ive never had the need to access an MS Offcie object from within PHP
I suspect that you may need to use something like
$pres->Slides[1]->Shapes->AddTextbox(1,20,50,300,40);
$pres->Slides[1]->Shapes->TextRange.Text = "Test Box";
it could be something a bit dfferent, it could be
$pres->Slides[1]->Shapes->Text = "Test Box";

..you probably need to so some experimenting.

...if you dont have a copy of the full API, then a very effective way of learning the api is to create the object from within a VBA application and learn waht particualr settigns do. Quite often Microsoft API's have serveral ways of setting the same thing. It wouldnt surprise me if you could address each of the follwoing settings as
$pres->Slides[1]->Shapes->AddTextbox
$pres->Slides[1]->Shapes->Oreintation = 1
$pres->Slides[1]->Shapes->LeftMargin =20
$pres->Slides[1]->Shapes->RightMargin = 300
....etc
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #7 (permalink)  
Old 12-05-06, 06:43
Saravanan.R Saravanan.R is offline
Registered User
 
Join Date: Feb 2004
Location: India
Posts: 135
thanks for ur reply.

But it doesn't work with this syntax.
Reply With Quote
  #8 (permalink)  
Old 12-06-06, 04:40
rhs98 rhs98 is offline
Super Moderator
 
Join Date: Feb 2002
Location: Hampshire, UK
Posts: 441
Ok, I've not researched this at all, but it works nicely with word...it might not be what you want at all but thought it might help:

1. get a sample file (with some slides in)
2. save as html
3. make your code spit out the html based on 2
4. display with the correct content type - and (with word at least) it pops up in word looking like a normal doc.


Russ
Reply With Quote
  #9 (permalink)  
Old 12-06-06, 09:06
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
I seem to remember that on the PHP website their is amechanism which allows you to request a com object exposes/tells you al methods and properties that exist... might be worth a look
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #10 (permalink)  
Old 05-29-09, 07:07
lohi1234567 lohi1234567 is offline
Registered User
 
Join Date: May 2009
Posts: 1
How make Diagram in PowerPoint by PHP?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On