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

Enabling Outline in Previewer

edited October 2006 in General
If I select the design option in Report Explorer to enable and configure
Outline in a report template, I can see the Outline when I preview the
report.

If I then want to VIEW the same report in Report Explorer, there is no
Outline (although the Find Text box appears when also enabled).

I am not currently using a Previedw Form replacement so presume there is
only the default DM previewer active. I am therefore surprised that the two
paths detailed above produce different results!

I have looked at various threads about this and am now more confused than
before!

Do I need to add the code in AddOutlineToTppViewer.zip to a Custom Previewer
or should I instead create a TppPreview descendant?

As well as previewing reports when designing them, we want to be able to
preview them both from the Report Explorer AND directly from code e.g. where
we build a report on the fly. It would be good if all three used the same
previewer...

Can anyone point me in the right direction?

Thanks in advance...

Comments

  • edited October 2006
    Hi Pete,

    Which version of ReportBuilder/Delphi are you using? There may be a patch
    that will fix this issue.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2006
    Nico,

    We are using RB Enterprise 9.03 and Delphi 6 (SP2 I think)...

    Regards,

    Pete Colson

  • edited October 2006
    Hi Pete,

    In my testing with RB 10.04 and Delphi 6 I am unable to recreate the
    behavior you describe below. Here are the steps I'm taking.

    1. Open and run the Report Explorer demo.
    2. Create a new report.
    3. Set the Report.OutlineSettings.Enabled and Visible to True.
    4. Save the report.
    5. Preview the report directly from the explorer. The outline is visible.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2006
    Nico,

    Thanks for this, I managed to sort of get it working, although not the way
    it needs to...

    1. I am having to set ppReport.OutlineSettings.Enabled and
    ppReport.OutlineSettings to True in code OUTSIDE of the previewer.

    2. As well as allowing (Admin) users to view reports in Report Explorer, we
    also populate a Reports Menu from one of the folders in Report Manager, to
    allow standard users to be able to view/print the reports set up by the
    Administrators, without being able to amend the templates. We therefore have
    another unit that uses the ppReport.PrintToDevices method to load the
    previewer.

    Although I have added the same code as 1 above, this does not show the
    Outline even when viewing the same template I viewed in Report Explorer.

    So I am still faced with one working and one not....

    Is there any way I can resolve this?


    My custom previewer has not worked for a couple of years (the
    ppRegisterForm(TppCustomPreviewer, myCustomPreviewer method) as it comes up
    with an AV when trying to print. I use the unit instead to view and print
    reports on the fly (as mentioned above), which works fine (as long as the
    Initialization and Finalization sections are commented out).

    Is this method still valid for deveoping a Custom Viewer, or has is been
    superceeded? If so, what with?

    Regards,

    Pete Colson





  • edited October 2006
    Hi Pete,

    The best way to replace the preview form with the newer versions of RB is to
    use a PreviewPlugin. Take a look at the article below on how this can be
    done.

    I'm still unclear about what is happening. If you are loading templates
    that do not have their OutlineSettings.Enabled or Visible set to True, the
    outline will not show up regardless, unless you manually set the properties
    after they have been loaded or resave them. Where are you setting the
    outline settings in code?

    -----------------------------------------
    Article: Creating a Preview Plugin
    -----------------------------------------

    Q: I've followed the tutorials and registered a Preview Form replacement but
    that did not affect the TppDesigner's Preview workspace.


    A: Do not use the form replacement, but rather, there is a different
    architecture built into the preview form that is registered by default.



    You will need to register a TppPreview descendent. The class you register
    is used to create the preview controls inside the standard print preview
    form and the designer preview workspace.


    Here is an example of creating a simple custom preview that access the
    viewer its been assigned in order to change the page color. You can also do
    more advanced operations such as adding and removing buttons and change the
    behavior of the preview form. Access the inherited controls via. protected
    properties and override the virtual methods in order to customize behavior.

    Open ppPreview.pas and view the TppPreview class as a guide to create a
    custom preview descendent.


    unit MyPreviewPlugin;

    interface

    uses
    ppPreview;

    type
    TMyPreviewPlugin = class(TppPreview)
    public
    procedure BeforePreview; override;

    end;


    implementation

    uses
    Graphics;


    procedure TMyPreviewPlugin.BeforePreview;
    begin
    inherited BeforePreview;

    Viewer.PageColor := clRed;

    end;

    initialization
    TppPreviewPlugIn.Register(TMyPreviewPlugin);

    finalization
    TppPreviewPlugIn.UnRegister(TMyPreviewPlugin);

    end.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2006
    Nico,

    Thanks for your response.

    Before I got your reply, I had created a Preview Plugin and everything
    within Report Explorer works OK (e.g. both Design Preview and direct
    Preview). One down, one to go!

    As mentioned previously, we also have the ability to do data queries outside
    of the template and then pass the data query and template to a Custom
    Preview unit we have created which EMULATES the default previewer e.g. we
    create the toolbar at the top and use a ppViewer component.

    I now realise that we are probably doing it the hard way....

    Becaue of the method described above (create data query and pass to the
    template) we need to provide the user with the ability to both preview the
    report AND make design changes where necessary (and authorised!).

    To this end I think the best solution is to add a Design button to the
    Preview Plugin unit, and do away with our old Custom Preview unit (as you
    suggested!).

    Have now added the button but am not sure how to make my new Design button
    not visible when the Previewer is active in the either the report Designer
    or Viewer, when in Report Explorer (tried Viewer.DesignViewer to no avail).

    Any suggestions?

    Regards,

    Pete Colson.





  • edited October 2006
    Hi Pete,

    One option is to create two preview plugins, one with the design button
    added and one without. Then based on the user privileges, you can register
    the proper plugin.

    --
    Regards,

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

    Best Regards,

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