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

OnGetFileSuffix event on TppGroup

edited March 2012 in Devices
Hi,

I'm using this event to create a new document (PDF) for each page of a
report I'm generating named specifically for the client that the page
corresponds to (i.e. my report is grouped by ClientID)

This was working fine in Delphi2010 with Report Builder ver 11.08, but since
we've upgraded to Delphi XE2 and Report builder ver 14.02 and now 14.03 it's
not producing any files at all. When I debug my report it appears to be
stepping through my onGetFileSuffix event OK and giving me a file name but
it end up producing a file called "_" in the folder where my EXE is running
from.


Here's some sample code....

My btnPrint on click handler does....

ppReport2.ShowPrintDialog := False;
ppReport2.AllowPrintToFile := true;
ppReport2.PDFSettings.OpenPDFFile := false;
ppReport2.PDFSettings.CompressionLevel := System.ZLib.clMax; //clNone;
ppReport2.PDFSettings.ScaleImages := false;
ppReport2.DeviceType := dtPDF;
OutputDevice := 'PDF';
ppReport2.TextFileName := '_';
ppgroup9.GroupFileSettings.NewFile := True;
ppReport2.Print;


my onGetFileSuffix handler is....

procedure TFormrptrbPaymentInvoice.ppGroup9GetFileSuffix(Sender: TObject;
var Text: string);
begin
inherited;
Text := Format('c:\Website\reports\%s_paymentsreport',
[cdsRPayhdr.FieldByName('KPIN').AsString]);
end;


As I said the onGetFileSuffix event seems to run as expected. Have I missed
setting a property on my report or something? In case it's relevant there is
a group (i.e. corresponding to Group Header [0]) above my ppGroup9 (which
corresponds to my Group Header [1]

TIA

Willie

Comments

  • edited March 2012
    Sorry, I said "This was working fine in Delphi2010 with Report Builder ver
    11.08, but since
    we've upgraded to Delphi XE2 and Report builder ver 14.02 and now 14.03 it's
    not producing any files at all. " but it does produce a file called "_" in
    the folder where my EXE is running
    from so please ignore the "not producing any files at all" part of my
    original post.
  • edited March 2012
    Hi Willie,

    In my testing with the latest version of ReportBuilder and code similar
    to yours, the group files seemed to export correctly to the directory
    assigned with the custom names. Are you able to recreate this issue
    with a simple example I could run on my machine? If so, please send it
    in .zip format to support@digital-metaphors.com and I'll take a look at
    it for you.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.