Mailinglisten-Archive |
Hallo Liste,
folgendes Beispiel (PHP-Manual und
http://www.phpbuilder.com/columns/alain20001003.php3 )
funktioniert fast, das heisst es wird eine Instanz von
Word geöffnet, das Dokument erzeugt, nur ein Problem:
Das Schliessen von Word funktioniert nicht, das heisst
Der entsprechende Prozess bleibt im Task-Manager und
lässt sich dort auch nicht abschiessen. (Zugriff verweigert).
Mein System:
Win2K, Apache 1.3.20, PHP 4.0.6, Office 2000
Example 1. COM example (1)
<?php// starting word
$word = new COM("word.application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}\n";
//bring it to front
$word->Visible = 1;
//open an empty document
$word->Documents->Add();
//do some weird stuff
$word->Selection->TypeText("This is a test...");
$word->Documents[1]->SaveAs("Useless test.doc");
//closing word
$word->Quit();
//free the object
$word->Release();
$word = null;?>
------Ende Example
Ich habe auch mal ein Beispiel von einer ASP-Seite
ausprobiert, in dem in VB eine AcitveX-DLL erstellt wird,
die sich mit PHP aufrufen lässt:
(siehe http://www.php.net/manual/de/ref.com.php )
<?
$instance = new COM("Checkyear.LeapYear");
$isleapyear = $instance->IsLeapYear($year);
$instance->close();
if($isleapyear) {
echo "The <b>$year</b> is a leap year";
}
else {
echo "The <b>$year</b> is not a leap year";
}
?>
Auch hier funktioniert das bis auf das Schliessen, was
ich recht unschön finde.
??? Bug oder geht das nur mir so ?
Ciao
Christoph Loeffler
mailto:chris_(at)_breisnet-online.de
php::bar PHP Wiki - Listenarchive