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

Report Printing

edited August 2005 in Devices
?I am new to Delphi 4, am adding reports to existing Delphi program.
Have Preview & Print buttons for rpt. If choose Preview, the rpt shows
correctly (sorts & filters included) and will print to default printer if
printer icon clicked. However, if click the Print button I receive error
msg "EAccessViolation". Am stumped now. Any help appreciated. Example
of code used OnClick event: rSalesPriceList.DeviceType := 'Printer';
rSalesPriceList.Print;
Thanx in advance,
Laura



--- posted by geoForum on http://delphi.newswhat.com

Comments

  • edited August 2005
    Hi Laura,

    Which version of ReportBuilder are you currently using? If you set your
    Delphi IDE to stop on exceptions, where is the error occuring?

    If you are a new user of ReportBuilder, I would definitely recommend reading
    and working through the tutorials provided in the ReportBuilder Developer's
    Guide located in the \RBuilder\Developer's Guide\... directory. This will
    give you a good base on using ReportBuilder and what it is capable of.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited September 2005
    Nico, I found that my problem occurs when I use an OnBeforePrint Event
    handler to maximize the Preview to full screen.
    TppCustomReport(Sender).PreviewForm.WindowState := wsMaximized;
    TppViewer(TppCustomReport
    (Sender).PreviewForm.Viewer ).ZoomPercentage := 100;
    I must be missing something - but it is the introduction of this event
    that blows up the Print command. Any more suggestions? and Thanx!


    reading
    Developer's
    will
    if
    error



    --- posted by geoForum on http://delphi.newswhat.com
  • edited September 2005

    1. You should use the Report.OnPreviewFormCreate event to access the
    PreviewForm

    2. The problem with your current code is that Reprot.PreviewForm is nil. The
    preview form is not created when the report is printed to the printer.

    3. In general, you should never typecast an object without first checking
    its type and you should not reference an object's properties without testing
    whether the object is nil.

    Example:

    var
    lReport: TppReport;

    begin

    if (Sender is TppReport) then
    begin
    lReport := TppReport(Sender);

    if (lReport.PreviewForm <> nil) then
    lReport.PreviewForm.WindowState := wsMaximized;

    end;

    end;

    4. Here is a list of resources for learning ReportBuilder that you might
    find helpful.

    ---------------------------------------------------------------
    Article: Resources for Learning ReportBuilder
    ---------------------------------------------------------------

    1. Learning ReportBuilder is a complete learning system designed to teach
    end users how to build a range of reports, but it is also an excellent
    resource for the developer who is just getting started with RB. Learning RB
    includes a 125-page PDF file, a stand-alone application complete with a
    database, and a help file. The PDF file contains a set of tutorials, which
    can be completed using the provided application. Learning ReportBuilder can
    be downloaded from:

    http://www.digital-metaphors.com/LearnRB/LearnRB.exe

    2. Learning to RAP is designed to teach end-users how to use ReportBuilder's
    Calc workspace to perform calculations and control visual aspects of the
    report while it is generating. Learning to RAP includes a 59-page PDF file
    and a stand-alone application complete with a database. The PDF file is
    comprised of a series of tutorials that step end users through the process
    of coding calculations and event-handlers to dynamically control report
    generation. The application is used in conjunction with the tutorials so
    that the learning experience is interactive. Learning ReportBuilder - RAP
    can be downloaded from:

    http://www.digital-metaphors.com/LearnRB/LearnRap.exe

    3. Developer's Guide

    When you install RB, this guide is automatically installed into the
    RBuilder\Developers Guide directory. It contains extensive conceptual
    information and step by step tutorials which show how to construct reports
    and reporting applications within the context of the Delphi IDE.


    4. On-Line Help

    Accessible via a single click of the F1 key from with the Delphi IDE, this
    reference resource explains the classes, methods, properties and events
    which make up the product. It is also an excellent source of information
    regarding installation, troubleshooting and version history.


    5. Examples

    There are a large number of example reports and reporting applications
    included with RB. These show how to accomplish some of the most frequently
    requested types of reports. In total there are probably over 200 different
    examples covering everything from crosstabs to full-blown end-user reporting
    solutions. The RAP functionality included with ReportBuilder Enterprise has
    a separate set of demos, tutorials, and help files.


    6. news.digital-metaphors.com

    The newsgroups are very active with both Digital Metaphors engineers, TeamDM
    members (volunteers specially selected for their knowledge of RB and their
    willingness to help) and RB developers all pitching in to answer questions
    and help each other out. There is also a Tech Tips 'newsgroup' maintained
    by DM Engineers which lists over 100 different articles outlining various
    tips and techniques. Probably the easiest way to connect to the newsgroups
    is to surf the digital metaphors site, go to the support section and click
    the newsgroup of your choice:

    http://www.digital-metaphors.com/Subpages/Support/newsgroups.html


    ReportBuilder newsgroup archives may be searched using a search engine
    hosted by Tamarack Associates. Access the the following URL and then search
    the Borland Newsgroup database. Tamarack has indexed the ReportBuilder
    newsgroup archives in this database.


    http://www.tamaracka.com/




    7. support@digital-metaphors.com

    When you are working on the really advanced stuff, and need an additional
    point of view, we're always glad to help.



    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com



    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.