views:

11

answers:

0

Hi,

I am using PHP COM Object but i guess it is the same in all other languages. How do i add watermark to a .doc / .docx Microsoft Word using COM / OLE Automation?

    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); //

Thanks.