Home Devices
New Blog Posts: Merging Reports - Part 1 and Part 2

Send report as email body

edited July 2011 in Devices
Hello

Delphi 6, RB Server 11.08

We currently provide the facility to email reports in all manner of
attachment format, using the Indy support provided with RB.

However, we now have a new requirement to actually send the report as the
BODY of the email, not as an attachment. This is essentially a mail merge,
but the letter is being emailed to the individual instead of printed.

I do not want to email someone an attachment, I would like the body of the
email to appear as the report does on screen. Can this be done and does
anyone have any experience of doing this?

Regards,
Jason Sweby.

Comments

  • edited July 2011
    Hi Jason,

    This is not a built-in feature of ReportBuilder. The Email feature is
    designed to only send an attachment of a report in an exported file type.

    One option would be to generate the report, then transfer the mail-merge
    RichText text once it has been created to a separate Indy Message and
    send it manually without using the RB Email feature.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2011
    Hi Nico

    Yes I had considered the same option, thank you very much for clarifying the
    position and letting me know.

    Jason.

  • edited July 2011
    Nico

    I've been trying to implement this but am struggling to get the rich text
    back out from the report.

    My initial thought (the long way round) was to save the report as an RTF
    file, then load it back into Delphi's TRichEdit and move forwards from
    there. However, the RTF generates OK (and can be opened in Word) but Delphi
    cannot seem to read the file that was generated by RB.

    I have tried opening it in a Delphi form (into a TRichEdit) and back into
    ReportBuilder's TppRichText component. In Delphi, this causes the error
    "Richedit line insertion error". In RB, nothing happens, I just end up with
    an empty ppRichText.

    Instead, is there some code I can use to extract the RichText code from the
    report once it has generated?

    Thanks,
    Jason.

  • edited July 2011
    Nico

    Never mind, I've switched to HTML output which is easier to control and far
    more suited to emails anyway.

    Thanks,
    Jason.

This discussion has been closed.