Ver Mensaje Individual
  #14  
Antiguo 11-10-2006
Carliviris Carliviris is offline
Miembro
 
Registrado: abr 2006
Posts: 93
Reputación: 19
Carliviris Va por buen camino
me da este error cuando intento usar el document.printout:


Código Delphi [-]
---------------------------
Debugger Exception Notification
---------------------------
Project contratos.exe raised exception class EOleError with message 'Method 'PrintOut' not supported by automation object'. Process stopped. Use Step or Run to continue.
---------------------------
OK   Help   
---------------------------

Aqui les presento la parte del codigo donde utilizo el printout:

Código Delphi [-]
function TwinMain.CONTRATO_StringReplace(ADocument: TFileName; Sender: TObject): Boolean;
const
  wdFindContinue = 1;
  wdReplaceOne = 1;
  wdReplaceAll = 2;
  wdDoNotSaveChanges = 0;
var
 i           : integer;
 Flags       : TWordReplaceFlags;
begin

  Result := False;
  Flags  := [wrfReplaceAll];

  { Chequea si el archivo existe }
  if not FileExists(ADocument) then
   begin
    ShowMessage('El documento especificado no existe');
    Exit;
  end;

  { Creando el Objeto Ole }
  try
    WordApp := CreateOLEObject('Word.Application');
  except
    on E: Exception do
    begin
      E.Message := 'Microsoft Word no esta habilitado';
      raise;
    end;
  end;

  Contrato_SearchString;

  try
  { Ocultar Microsoft Word }
   WordApp.Visible := true;
    { Abrir el documento }
   WordApp.Documents.Open(ADocument);

   { Inicializacion de los parametros}
    for i:= 1 to 28 do
     begin
       //Para desplegar el desglose_inicial//
       if i = 27 then
        Desg_Inicial_Cont;

       if ((i <> 28) and (i <> 27)) 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
            //Para desglose_cuotas//
           DesgloseCuotas;
        end;
     end;
     finally
      WordApp.Documents.PrintOut;
Responder Con Cita