// 启动 word $word = new COM("word.application") or die("Unable to instanciate Word"); print "Loaded Word, version {$word->Version}\n";//将其置前 $word->Visible = 1;//打开一个空文档 $word->Documents->Add();//写些东西到word里面,并保存为test.doc $word->Selection->TypeText("This is a test...something to wirte in"); $word->Documents[1]->SaveAs(getcwd().'\test.doc');//关闭 word $word->Quit();//释放对象 $word->Release(); $word = null;
$word = new COM("word.application") or die("Unable to instanciate Word");
print "Loaded Word, version {$word->Version}\n";//将其置前
$word->Visible = 1;//打开一个空文档
$word->Documents->Add();//写些东西到word里面,并保存为test.doc
$word->Selection->TypeText("This is a test...something to wirte in");
$word->Documents[1]->SaveAs(getcwd().'\test.doc');//关闭 word
$word->Quit();//释放对象
$word->Release();
$word = null;