Is it possible to change the title of a report in code using delphi code

I am struggling to change the title of a report which can be executed after different sql commands have been executed to filter the data that the report will show

For example - select * from coachdata order by surname

I would like this printout to have the title 'All Coaches - Alphabetic'

Using the same report and filtering by postcode i.e.

select * from coachdata where postcode is NULL

I would like this printout to have the Title Missing Postcodes

There are about 20 different combinations of the report.

Obviously I do not want to use 20 separate frxReport components to achieve my goal

I have searched all of the usual info sites and the only reference I can find is to build the report on the fly in code and not use the built in designer - again not an ideal situation

Any Help much appreciated

Bob Wallace


  • G'day Bob,

    I am not sure where you want to use the Title, but if you are like us you probably want to see it:

    • in the Report Header of your previewed / printed Reports
    • on the Caption of the Preview Form
    • as the default File Name when you save / export the Report

    We do this for our major App's Reports prefixing the "Title" with the Financial Year number and suffixing some of them with User selection information (e.g. "Settled", "Unposted").

    To achieve this, the first Property to set is your Report's (TfrxReport Component) "Filename".

    This will possibly be enough for you. If I understand your question correctly, the changes need to be made after the SQL is set up for the Query, so you probably need to set Filename in the OnBeginDoc Event Handler.

    Hope this is helpful...

    Cheers, Paul

  • Use in the report's script (free FR Embarcadero edition doesn't have script support):

    procedure Page1OnBeforePrint(Sender: TfrxComponent);


    if MasterData1.DataSetName = 'MissingPostCodes' then Memo1.Text :=' Missing Post Codes'

    else if MasterData1.DataSetName = 'AllData' then Memo1.Text :='All Coaches Alphabetic';


  • edited February 7

    Create a text object place holder on the report named ReportTitle. Set it's Text property to 'Report Title'.

    In your app, use TfrxReport.FindObject to locate ReportTitle and then cast and set the objects Text property if it has one.

    You'll have to convert this to Delphi:

    void TDMFastReportHelper::SetObjectText(const TfrxReport* report, const String object_name, const String val)
        TfrxComponent* report_object {report->FindObject(object_name)};
        if (report_object)
            if (dynamic_cast<TfrxMemoView*>(report_object) != nullptr) {
                static_cast<TfrxMemoView*>(report_object)->Text = val;
            if (dynamic_cast<TfrxBarCodeView*>(report_object) != nullptr) {
                static_cast<TfrxBarCodeView*>(report_object)->Text = val;
            if (dynamic_cast<TfrxBarcode2DView*>(report_object) != nullptr) {
                static_cast<TfrxBarcode2DView*>(report_object)->Text = val;
    You can the do this:
    TDMFastReportHelper::SetObjectText(Report, "UserName", dm_system->LocalUserName);
    TDMFastReportHelper::SetObjectText(Report, "ComputerName", dm_system->LocalComputerName);
    TDMFastReportHelper::SetObjectText(Report, "RegisteredOwner", dm_system->RegisteredOwner);
    TDMFastReportHelper::SetObjectText(Report, "Workgroup", dm_system->LocalWorkgroup);
    TDMFastReportHelper::SetObjectText(Report, "DomainName", dm_system->DomainName);
    TDMFastReportHelper::SetObjectText(Report, "IPAddress", dm_system->IPAddress);

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.