Ver Mensaje Individual
  #3  
Antiguo 14-09-2006
Carliviris Carliviris is offline
Miembro
 
Registrado: abr 2006
Posts: 93
Reputación: 18
Carliviris Va por buen camino
la forma es la siguiente, es solo una parte del codigo:

Código Delphi [-]
 
  try
    { Ocultar Microsoft Word }
    WordApp.Visible := true;
    { Abrir el documento }
    WordApp.Documents.Open(ADocument);
    { Inicializacion de los parametros}
    i:= 0;
    for i:= 1 to 28 do
     begin
      if i <> 28 then
       begin
         WordApp.Selection.Find.ClearFormatting;
         WordApp.Selection.Find.Text := SearchStr[i];
         WordApp.Selection.Find.Replacement.Text := ReplaceStr[i];
         WordApp.Selection.Find.Forward := True;
         WordApp.Selection.Find.Wrap := wdFindContinue;
         WordApp.Selection.Find.Format := False;
         WordApp.Selection.Find.MatchCase := wrfMatchCase in Flags;
         WordApp.Selection.Find.MatchWholeWord := False;
         WordApp.Selection.Find.MatchWildcards := wrfMatchWildcards in Flags;
         WordApp.Selection.Find.MatchSoundsLike := False;
         WordApp.Selection.Find.MatchAllWordForms := False;
         { Perform the search}
         if wrfReplaceAll in Flags then
           WordApp.Selection.Find.Execute(Replace := wdReplaceAll)
         else
         WordApp.Selection.Find.Execute(Replace := wdReplaceOne);
       end
       else
        begin
          conData.qrPagard1.First;
          Count := conData.qrPagard1.RecordCount;

Estos son las dos lineas mas relevantes. Una busca el texto y la otra lo reemplaza:

Código Delphi [-]
  WordApp.Selection.Find.Text := SearchStr[i];
               WordApp.Selection.Find.Replacement.Text := ReplaceStr[i];

Esa es la manera en la cual lo hago
Responder Con Cita