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

Strange behaviour with RTM files and PrintToFile setting

edited April 2005 in End User
I have a couple of pre-defined RTM files which I loaded into the End User
application which is based on the standard demo application. My version of
the EndUser application is slightly changed, one of the options added being
that the user can print out the reports to PDF format. To this end I have
added the ppPDFDevice unit to the Uses clause. (Actually this is the only
change I have made besides changing the database to a DBISAM 4.18 format)

All fine and dandy when the user creates a new report and saves it - this
report can be printed to PDF device. No problems there.

However, if an "old" report is loaded from an RTM file, and prints, the PDF
function is not available. No surprises there however there is no way to
add this into the report definition (other than recreating the report from
new).

But if I clear out the "old" report and then start afresh, the
AllowPrintToFile property of the new report is no longer active or available
so I have to close down the application and create the old report as if it
never existed - then and only then is the AllowPrintToFile setting valid for
the PDF device.

Try it. I would dearly love the ability to add in some of the "missing"
property settings without having to resort to making too many changes -
surely (some of) these should also be available to the end user?

Thanks for any suggestions - cheers, David

Comments

  • edited April 2005
    Hi David,

    I'm a bit unclear about how you are getting this behavior. If you have the
    ppPDFDevice in your uses clause, the PDF option as a file device should be
    available no matter which report you load into the report object. In my
    testing, using a report created with RB 7.04, then loading it in the
    end-user demos of RB 9.02, I was able to export to PDF successfully.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2005
    Hi Nico; it seems that if I have an "imported" RTM report file which
    *didn't* originally have the AllowPrintToFile set to True and I load it

    (1) there seems to be no way I can set the AllowPrintToFile to true
    (2) it doesn't appear in the print to file combo possibilities
    (3) if I clear the buffers and start with a "new report" option there is no
    way that the fresh report will allow (2) above to be accessible.

    However if I restart the entire application and then load a report file
    *with* the AllowPrintToFile=True set I have the ability to write the file to
    PDF format and if I create a new report from scratch the property remains
    set.

    I hope that this makes it clearer. It seems that once an imported report
    which *didn't* have the property set is read in it clears the property set
    in the ppReport component.

    Is there no way I can access this property somewhere in the toolbars besides
    the print dialog - eg: if it's not available in the print dialog is there
    any other avenue of setting this at runtime?

    cheers - David

  • edited April 2005
    I just suddenyl thought (on re-reading your message) was the original 7.04
    report already defined with AllowPrint toFile:=True? If that is the case
    then it's showing the behaviour which I'm referring to, being if the setting
    is *already* there then it will work, if *not* then it won't and the only
    way you can force it is to introduce it into the saved report definition
    file by hand and I wouldn't want my end-users to be confronted with that
    task!

    cheers - David

  • edited April 2005
    Hi David,

    This is definitely the issue. From here you have three options to try.

    1. RB 9.02 now allow the end user to alter the AllowPrintToFile property
    using the new built-in object inspector attached to the report tree.

    2. Load all your reports manually and re-save them with the
    AllowPrintToFile property set to True, then redistribute them to your
    customers.

    3. Impliment the Template.OnLoadEnd event and set the AllowPrintToFile
    property there once each template has been loaded. (See the article below).

    ----------------------------------------------
    Tech Tip: Using Template Events
    ----------------------------------------------

    The Report.Template object has several events that can be used for
    customizing what happens when a report is loaded or saved:

    - OnLoadStart
    - OnLoadEnd
    - OnNew
    - OnSaveStart
    - OnSaveEnd


    The OnLoadEnd and OnNew events are often used to perform actions related to
    report and data initialization.

    The OnSaveEnd event is often used to save additional descriptive ("meta")
    data to the database each time the report is saved.

    Example:

    The Report.Template events are public and therefore must be assigned at
    run-time.


    1. In the private section of your form declaration you can declare an
    event-handler method:

    TForm = class(TForm)
    private
    procedure myTemplateOnLoadEndEvent(Sender: TObject);

    public

    end;


    2. In the Form.OnCreate event, you can assign the event-handler to the
    event:

    procedure TForm1.FormCreate(Sender: TObject);
    begin

    ppReport1.Template.OnLoadEnd := myTemplateOnLoadEndEvent;

    end;


    3. Implement the event-handler method:

    procedure TForm1.myTemplateOnLoadEndEvent(Sender: TObject);
    begin

    {add code here to initial the report or data, etc. }
    ppReport1.PrinterSetup.MarginTop := 0.5;

    end;


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2005
    Thanks Nico. I had looked through the Report Tree as well but somehow or
    other I missed the section "Output - File" where of course the end user can
    change all manner of settings.

    "There are none so blind as those who cannot see!" If it had had teeth it
    would have bitten me but I overlooked it!

    Once again thanks for your patience in helping out here.

    cheers - David

This discussion has been closed.