Getting access to Custom Properties in a word document
| From: | Farhad Pezeshgi | Date: | Wed, 19 Jun 2002 07:17:07 +0000 |
| Subject: | Getting access to Custom Properties in a word document | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-14296@lists.php.net to get a copy of this message | ||
Hello,
This is my first posting on this forum.
Currently I am trying to open a word document on my server and to change its custom properties. I have tried many different code segement but I can not get it to work. Here is the basic code for PHP:
// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}\n";
$word->Visible = 1;
//open an exiting document
$document = $word->Documents->Open( "$path$oldfilename" );
if (isset( $document ))
{
print "got document {$document}\n";
}
$word->ActiveDocument->CustomDocumentProperties->Item("DocDate")->Value = $today;
$word->Documents[1]->SaveAs("Useless test2.doc");
//closing word
$word->Quit();
//free the object
$word->Release();
$word = null;
I have had no success in getting this code to work. Could anyone help me.
Thank you in advance.
Could you please mail direct to me.
Farhad