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;