I am trying to modify the built in document properties for a word document based on input from a PHP form.
I have been able to open the document and get the value, but I have not been able to set the value. Here is my code.
// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
// echo "Loaded Word<br>";//, version {$word->Version}\n";
//bring it to front
$word->Visible = 1;
//open a document
$word->documents->Open($upfile) or die("Couldn't Open document");
$doc = $word->documents[1] or die("Couldn't reference document");
// Get Metadata
$strTitle = $doc->BuiltInDocumentProperties[1]->Value;
$strSubject = $doc->BuiltInDocumentProperties[2]->Value;
$strAuthor = $doc->BuiltInDocumentProperties[7]->Value;
$strKeywords = $doc->BuiltInDocumentProperties[4]->Value;
// Niether of the below code sets returns an error
// Niether changes the property value
// Apparently, PHP has overloaded the = sign
//Set 1
//Properties dialog
$dp = $word->Dialogs[86];
// Set "Title" to a new value.
$dp->Title = "My Title";
// Set the value without showing the dialog.
$dp->Execute;
//Set 2
$dp = $doc->BuiltInDocumentProperties;
//' Set KeyWords for the active document by
//' using a literal string.
$kw= $dp[7] ;
$kw->Value = "Using Builtindocumentproperties";
$doc->Save();
//closing word
$doc->Close();
$word->Quit();
//free the objects
$doc = null;
$word = null;
Any help would be appreciated