insert text, ms word document

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


i've hit a wall regarding php and ms word.  what i want is to open a
document containing bookmarks, insert text where the bookmarks are, and

it's working, unless the bookmark is in the header part of the page (re
header/ footer).  in that case i get an error saying the bookmark
wasn't found/ doesn't exist.

anyone got any tip on how to get into the header part of a word
document using php?

the following, simple code works when bookmark is in the main part of

$empty = new VARIANT();
$word = new COM("word.application") or die ("some explanation");
$word->Documents->Open("C:\Path\Document with bookmark.doc");
$word->Selection->GoTo(wdGoToBookmark, $empty, $empty, "bookmark");
$word->Selection->TypeText("text to be inserted");
$word->Documents[1]->SaveAs("C:\Path\with inserted text.doc");
$word = null;


Site Timeline