PHP Conference Nagoya 2025

COM et .Net (Windows)

add a note

User Contributed Notes 1 note

up
7
acsandeep at gmail dot com
15 years ago
If you are trying to get the properties of a Word document opened via COM object, you may need to define some constants in your script like so.

<?php
define
('wdPropertyTitle', 1);
define('wdPropertySubject', 2);
define('wdPropertyAuthor', 3);
define('wdPropertyKeywords', 4);
define('wdPropertyComments', 5);
define('wdPropertyTemplate', 6);
define('wdPropertyLastAuthor', 7);

$word = new COM("word.application") or die ("Could not initialise MS Word object.");
$word->Documents->Open(realpath("Sample.doc"));
$Author = $word->ActiveDocument->BuiltInDocumentProperties(wdPropertyAuthor);

echo
$Author;
?>
To Top