PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : MS WORD/PHP combo


moehome
14.05.2002, 14:53
Hi all,
I´d like to run a simple PHP script which opens a word file and extracts some specific parts of that file, followed by a screen output of the text. I´m already able to open that file, but as I try to run:

$word = new COM("word.application") or die("Unable to instantiate Word");
$scr = $word->paragraphes(1);
$scr2 = com_get($scr,ranges);
echo $scr2;

I see everything but my text.

Please help, or tell me how to "translate" VBScripts into PHP/COM
(eg $word->paragraphes(1)->ranges; doesn´t work, but in VBS
activedocument.paragraphes(1).ranges runs without trouble)
_________________
greez moe


pate33
14.05.2002, 15:07
Hi moehome,

I had not worked with the COM class yet, but you may try:

$scr = $word->paragraphes("1");

with quotation mark...

(...just an idea...)

so long

croudjay
21.05.2003, 13:48
Hi @ALL,

for all who are interessted.
@first: myenglishsucks:phpismylife:codingrules

whatever...

the solution of your problem is this:


<?
$word=new COM("word.application") or die("Cannot start MS Word");
print "Loaded word version ($word->Version)\n";
$word->visible = 1 ;
$word->Documents->Add();
$word->Selection->Typetext("CODING-BOARD");
?>

Jan Krüger
21.05.2003, 22:27
I can't see you opening a file anywhere, but perhaps that's just me being stupid...?

croudjay
22.05.2003, 14:20
Ups sorry, hab jetzt erst richtig verstanden was du wolltest sorry. Naja, dachte du wolltest nur eine Variable an Word übergeben.

Nochmals sorry