note 37525 added to class.com
| From: | drich at nea-online dot net | Date: | Tue, 18 Nov 2003 19:47:40 +0000 |
| Subject: | note 37525 added to class.com | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60585@lists.php.net to get a copy of this message | ||
Changing Fields (Not FORMFIELDS) In MS Word....
Searched most of the afternoon for this, as it is something needed here for our projects. Maybe
this can help someone else as well.
<?php
$input = "x:\\path\\to\\test.doc";
$word = @new COM("word.application") or die("Unable to instantiate Word");
print "Loaded Word, version {$word->Version}\n<br>";
$word->Visible = 1;
print "Set Word To Visible<br>";
$word->Documents->Open($input);
print "Opened $input<br>";
$word->Activate;
print "Activated Word<br>";
print "Editing Fields<br>";
$Field = $word->ActiveDocument->Fields(1);
$fieldData = $Field->Result;
$fieldData->Text = "Testing";
// Print the document.
$word->Printout();
// closing word
$word->Quit();
// free the object
$word->Release();
$word = null;
?>
I have yet to find a way to access the fields by Name, and I am painfully comming to the conclusion
that it's simply not possible.
----
Manual Page -- http://www.php.net/manual/en/class.com.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37525
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37525&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37525&report=yes
Search -- http://master.php.net/manage/user-notes.php