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];
if not FileExists(ADocument) then
begin
ShowMessage('El documento especificado no existe');
Exit;
end;
try
WordApp := CreateOLEObject('Word.Application');
except
on E: Exception do
begin
E.Message := 'Microsoft Word no esta habilitado';
raise;
end;
end;
Contrato_SearchString;
try
WordApp.Visible := true;
WordApp.Documents.Open(ADocument);
for i:= 1 to 28 do
begin
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;
if wrfReplaceAll in Flags then
WordApp.Selection.Find.Execute(Replace := wdReplaceAll)
else
WordApp.Selection.Find.Execute(Replace := wdReplaceOne);
end
else
begin
DesgloseCuotas;
end;
end;
finally
WordApp.Documents.PrintOut;