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

Print to Screen - error

edited December 2012 in Devices
hello :

We port our report from versi?n 7.04 for Delphi 7 to versi?n 12.05 for Delphi 7.

After doing this our reports print well to printer or file but if we try to print to screen we receive an access error 'Pointer Operation not valid". Other times error is like "Class EreadError with message 'Property Field"

We have implemented two options.

First :

//// code
AppReport.ModalPreview := True;
AppReport.DeviceType := dtScreen;
AppReport.OnPreviewFormCreate := CrearPrevisualizacion;
AppReport.print;
////

being

//// code
procedure TdlgOpcionesImpresion.CrearPrevisualizacion( Sender : TObject );
begin

TppReport( Sender ).PreviewForm.WindowState := wsMaximized;
TppReport( Sender ).PreviewForm.WindowState := wsMaximized;
TppViewer( TppReport( Sender ).PreviewForm.Viewer ).ZoomSetting := zs100Percent;
end;

////
or

//// code
Application.CreateForm( TfrmDezaReportBuilderPreview, frmDezaReportBuilderPreview );
try
frmDezaReportBuilderPreview.ppReport1 := AppReport;
frmDezaReportBuilderPreview.ShowModal;
finally
FreeAndNil( frmDezaReportBuilderPreview );
end;

////

being

//// code
unit DezaReportBuilderPreviewFORM;

interface

uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
ppCtrls,
ppVar,
ppPrnabl,
ppClass,
ppBands,
ppCache,
ppModule,
ppParameter,
ppComm,
ppRelatv,
ppProd,
ppReport,
ppDevice,
ppPreview,
ExtCtrls,
StdCtrls;

type
TfrmDezaReportBuilderPreview = class( TForm )
pnl1 : TPanel;
procedure FormDestroy( Sender : TObject );
procedure FormCreate( Sender : TObject );
procedure FormShow( Sender : TObject );
private
FPreview : TppCustomPreview;
FBusy : Boolean;
protected
procedure ehPreview_CloseEvent( Sender : TObject );
public
{ Public declarations }
ppReport1 : TppReport;
end;

var
frmDezaReportBuilderPreview : TfrmDezaReportBuilderPreview;

implementation

{$R *.dfm}

procedure TfrmDezaReportBuilderPreview.FormCreate( Sender : TObject );
begin

FPreview := TppPreviewPlugIn.CreatePreviewPlugin( pnl1 );
FPreview.OnClose := ehPreview_CloseEvent;
end;

procedure TfrmDezaReportBuilderPreview.FormDestroy( Sender : TObject );
begin
FPreview.Free;
FPreview := nil;
end;

procedure TfrmDezaReportBuilderPreview.ehPreview_CloseEvent( Sender : TObject );
begin

Close;
end;

procedure TfrmDezaReportBuilderPreview.FormShow( Sender : TObject );
begin
FPreview.Viewer.Report := ppReport1;
FPreview.BeforePreview;

if ppReport1.InitializeParameters then

// optionally display the autosearch dialog
if ppReport1.DisplayAutoSearchDialog then
begin
FPreview.Viewer.Reset;
ppReport1.PrintToDevices;
end;

end;

end.

////


if we trace in delphi any of this implementation then no error occurs.

What can we do ???






--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-

Comments

  • edited December 2012
    Hi Deza,

    This is not a known issue. Do the errors occur with every report
    previewed or only certain reports?

    If you are using RB 14.07, try setting the
    PreviewFormSettings.SinglePageOnly property to True and see if that
    solves the problem. (Also, Viewer.SinglePageOnly if you are using a
    custom viewer).

    Best Regards,

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