Hi there. I'm using a class to open a word doc and replace some words with
data from a query from a mYsql database. Everything works, with the
exeption of the replaxe words!!! can anyone help with this one. I'm
getting tired of looking to this and not understanding what happen!
this is the part of the class file created by Peter Cruickshank.
/ array $a - associative array of fieldnames and values to be assigned,
eg "FORENAME" => "Peter"/
//this prepares an array with the values to replace:
$a= array("CLIENTE"=>$Nome,"NOME"=>$Destinatario,"ASSUNTO"=>$Assunto,
"REFERENCIA"=>$referencia,"DIA"=>$dia,"MES"=>$mes,"ANO"=>$ano);
//this process the thing
function assign($a) {
while (list($var, $val)=each($a)) {
$this->fields[$var]=stripslashes($val);
}
}
//this should process the thing:
function process() {
$oFind = $this->word->ActiveDocument->Content->Find;
//Corresponding VBA is:
//expression.Execute(FindText, MatchCase, MatchWholeWord, MatchWildcards,
MatchSoundsLike, MatchAllWordForms, Forward, Wrap,Format, ReplaceWith,
Replace)
while (list($var, $val)=each($this->fields)) {
$oFind->Execute("{".$var."}", true, true, false, false, false,
true, true,false, $val, wdReplaceAll);
}
$this->fields = array(); // Clear out s&r ready for next time
} // process
So, why I can't replace this simple words!!!
thanks