0
我正在使用PHP COM對象,但我想它在所有其他語言中都是一樣的。如何使用COM/OLE自動化爲.doc/.docx Microsoft Word添加水印?Word OLE自動化水印添加在MS-Office COM對象
try
{
$word = new COM("word.application") //$word = new COM("C:\\x.docx");
or die(error::asString("couldnt create an instance of word", 20100408.01812, true));
//bring word to the front
$word->Visible = 1;
//open a word document
$word->Documents->Open($abs_filename);
$range = $word->ActiveDocument->Content();
$this->text = iconv('CP1255', 'UTF-8', $range->Text);
//save the document as html
// format: 0 - same?, 1 - doc?, 2 - text, 4 - text other encoding, 5 - ?, 6 - rtf , 8 - html
$word->Documents[1]->SaveAs($result_file_name, 8);
謝謝。