Home End User

Print Dialog: Assigning a value to the Text File Name

edited July 2012 in End User
I have RB Enterprise version 12.

I am using using the Report Explorer to preview reports. Clicking on
the Print button on the tool bar displays the Print Dialog. Using the
Print Dialog, I wish to create a PDF file with a predetermined name. I
was hoping the procedure below (modified from How To...Default Settings
for Reports) would allow this.

procedure TfmUserReports.InitializeReport(aReport: TppReport);
var
TodaysDate: string;
PDFFileName: string;

begin
// initialize report properties

aReport.SaveAsTemplate := False;
aReport.AllowPrintToFile := True;

TodaysDate := FormatDateTime('_yyyy-mm-dd_hhnn', Now);
PDFFileName := 'Default PDF File name' + TodaysDate;

// Assign a default value to the PDF File name
aReport.TextFileName := PDFFileName;

end;

Can you suggest a way that I can achieve this?

Thank you . . .


----------
Richard Harding

Comments

  • edited July 2012
    Hi Richard,

    The InitializeReport routine that you copied below likely fires too
    early to have an effect on the loaded template so when the template is
    loaded, all your settings are overwritten. You will need to use the
    Template.OnLoadEnd event to either execute the code below, or call
    InitializeReport routine. See the main EndUser demo for an example of
    implementing the OnLoadEnd event.

    Best Regards,

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

    Instead of using ppReport.TextFileName to assign the filename, I
    assigned the filename to the property ppReport.PrintDialog.TextFileName
    in the PrintDialogCreate event and everything works as I hoped.

    Thank you . . .

    Richard Harding



This discussion has been closed.