Jump to content

Recommended Posts

Posted

Hello , it's possible to have a sample of use of report builder when it's use to print a report in pdf and attache into email. 

this is my code but don't work nice. (code insert into a form )  call from a button .  

// Crea messaggi

   IdMessage1           := TIdMessage.Create(nil);    

    IdSMTP1              := TIdSMTP.Create(nil);

   IdSMTP1.Host         := ….

   IdSMTP1.Port         := …

   IdSMTP1.Username     :=  

   idSMTP1.Password:=…..

 

 

   IdMessage1.Subject   := ‘Hello word’;

   IdMessage1.From.Text := ……

   Idmessage1.BccList.Add.Address   := ……

   IdMessage1.CCList.Add.Address    := ….

   IdMessage1.Body.Add(‘….’);

 

    Report.DeviceType        := 'PDF';

 

    ppddiv.Lines.Text    :=wrk.FieldByName('iDdiv').asstring;

 

    NomePdf := UniServerModule.NewCacheFileUrl(False, 'pdf', '', '', AUrl, True);

    Report.TextFileName      := Nomepdf;

    Report.ShowPrintDialog   := False;

    Report.ShowCancelDialog  := False;

    Report.ModalCancelDialog := False;

    Report.ModalPreview      := False;

    Report.Print;

    sleep(2000);

    Attachment := TIdAttachmentFile.Create(IdMessage1.MessageParts,nomepdf);

    IdSMTP1.Connect;

    IdSMTP1.Send(IdMessage1);

    IdSMTP1.Disconnect;

   IdMessage1.Free;

   IdSMTP1.Free;

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...