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

Please, could u test this?

edited May 2005 in General
On the TppReport.OnPrintDialogCreate, I call ppPrinters.Refresh().

- Choose my printer
- Selected Pages: 1-2 (not 1;2),
-Click OK.

I get an Access Violation on page printing. if any of you meet this error,
please let me know. When I comment the line, everything runs fine.

David

Comments

  • edited June 2005
    Hi David,

    Sorry for the delay in this response, my news reader originally did not pick
    up on this post.

    In my testing, placing the call "ppPrinters.Refresh;" into the
    OnPrintDialogCreate seemed to work correctly. What else are you doing
    inside this event? If you trace into the Refresh code, which line is the AV
    occuring on? Do you have any printers installed to this machine?

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2005
    Sorry Nico,

    I was wrong. It's not in the OnPrintDialogCreate, but in the
    TppReport.BeforePrint event. Here is my code:

    procedure TFormMain.ppReportMasterBeforePrint(Sender: TObject);
    begin
    //ppPrinters.Refresh(); // COMMENTED
    if (ppReportMaster.FileDevice <> nil) then
    begin
    if (ppReportMaster.FileDevice is TppReportTextFileDevice) then
    begin

    TppReportTextFileDevice(ppReportMaster.FileDevice).CharacterGrid(130, 66);
    end;

    if (ppReportMaster.FileDevice is TppTextFileDevice) then
    begin
    TppTextFileDevice(ppReportMaster.FileDevice).TextFileType :=
    ftComma;
    end;
    end;
    end;


  • edited June 2005
    Hi David,

    After the report begins to print, the TppPrinter.GetPrinterSetup method is
    called numerous times and it appears that the BeforePrint event is fired in
    between some of these calls, causing the papernames list to reset and give
    you the AV. You will need to move this call to another event, preferably
    before the BeforePrint event is fired.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2005
    Thanx, Nico.

    It's good to see I'm not completely fool. :)

    David

This discussion has been closed.