note 37525 modified in class.com by didou
| From: | didou@php.net | Date: | Tue, 18 Nov 2003 23:12:31 +0000 |
| Subject: | note 37525 modified in class.com by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-60594@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;
?>
--was--
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.
http://www.php.net/manual/en/class.com.php