SoWesley

Relatório com Imagem (Client-Side)

Oct 8th, 2013
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.07 KB | None | 0 0
  1. //Impressão do relatório com imagem
  2. procedure btnPrintClick(Sender: TObject);
  3. var
  4.   rvImgRave: TRaveBitmap;
  5.   pgRelatorio: TRavePage;
  6.   Stream: TStringStream;
  7.   strAux: string;
  8.   srv: TServer;
  9. begin
  10.   rvCarteirinha.Open;
  11.   try
  12.     rvImgRave := rvCarteirinha.ProjMan.FindRaveComponent('FrenteFunc',pgRelatorio) as TRaveBitmap;
  13.     if rvImgRave <> nil then
  14.     begin
  15.       srv := TServerClient.Create(Sessao.Conn);
  16.       try
  17.         strAux := srv.ConsultaImagens('CSI_FRENTE_CAR_FUNC', 'TSI_CADESC', 'WHERE CSI_CODESC = ' +
  18.       Sessao.CodigoEscola);
  19.  
  20.         if strAux <> '' then
  21.         begin
  22.           Stream := TStringStream.Create(strAux);
  23.           try
  24.             strAux := TUteis.CaminhoTempDir + 'frente.bmp';
  25.  
  26.             Stream.SaveToFile(strAux);
  27.  
  28.             if FileExists(strAux) then
  29.               rvImgRave.FileLink := strAux;
  30.           finally
  31.             Stream.Free;
  32.           end;
  33.         end;
  34.       finally
  35.         srv.Free;
  36.       end;
  37.  
  38.     rvCarteirinha.ExecuteReport('Funcionario');
  39.   finally
  40.     rvCarteirinha.Close;
  41.   end;
  42. end;
Advertisement
Add Comment
Please, Sign In to add comment