Предварительный просмотр.
Сит
Вот маленький проект
===================
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, frxClass, frxPreview, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
frxPreview: TfrxPreview;
Report: TfrxReport;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Report.Preview := frxPreview;
Report.PreviewPages.LoadFromFile('Путь\Report_01.fp3');
Report.ShowPreparedReport;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Report.Preview := Nil;
Report.PreviewPages.LoadFromFile('Путь\Report_01.fp3');
Report.ShowPreparedReport;
Report.Preview := frxPreview;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
frxPreview.OutlineVisible := false;
end;
end.
===
Сначала нажмем кнопку 1
все нормально.
После нее нажимаем на кнопку 2
т.е вызвать стандартное окно просмотра готового отчета.
вылетает
Access violation at address......
где что прописать чтобы этого не было??
нажимаются кнопки в любом порядке...
== file dfm проекта
object Form1: TForm1
Left = 403
Top = 215
Width = 437
Height = 279
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 24
Top = 16
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 24
Top = 48
Width = 75
Height = 25
Caption = 'Button2'
TabOrder = 1
OnClick = Button2Click
end
object frxPreview: TfrxPreview
Left = 104
Top = 16
Width = 305
Height = 225
OutlineVisible = True
end
object Report: TfrxReport
Version = '3.15'
DotMatrixReport = False
IniFile = '\Software\Fast Reports'
PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator]
PreviewOptions.Zoom = 1.000000000000000000
PrintOptions.Printer = 'Ïî óìîë÷àíèþ'
ReportOptions.CreateDate = 38763.621730856480000000
ReportOptions.LastChange = 38763.621730856480000000
ScriptLanguage = 'PascalScript'
ScriptText.Strings = (
'begin'
''
'end.')
Left = 112
Top = 64
Datasets = <>
Variables = <>
Style = <>
end
end
Вот маленький проект
===================
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, frxClass, frxPreview, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
frxPreview: TfrxPreview;
Report: TfrxReport;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
Report.Preview := frxPreview;
Report.PreviewPages.LoadFromFile('Путь\Report_01.fp3');
Report.ShowPreparedReport;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Report.Preview := Nil;
Report.PreviewPages.LoadFromFile('Путь\Report_01.fp3');
Report.ShowPreparedReport;
Report.Preview := frxPreview;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
frxPreview.OutlineVisible := false;
end;
end.
===
Сначала нажмем кнопку 1
все нормально.
После нее нажимаем на кнопку 2
т.е вызвать стандартное окно просмотра готового отчета.
вылетает
Access violation at address......
где что прописать чтобы этого не было??
нажимаются кнопки в любом порядке...
== file dfm проекта
object Form1: TForm1
Left = 403
Top = 215
Width = 437
Height = 279
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 24
Top = 16
Width = 75
Height = 25
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 24
Top = 48
Width = 75
Height = 25
Caption = 'Button2'
TabOrder = 1
OnClick = Button2Click
end
object frxPreview: TfrxPreview
Left = 104
Top = 16
Width = 305
Height = 225
OutlineVisible = True
end
object Report: TfrxReport
Version = '3.15'
DotMatrixReport = False
IniFile = '\Software\Fast Reports'
PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator]
PreviewOptions.Zoom = 1.000000000000000000
PrintOptions.Printer = 'Ïî óìîë÷àíèþ'
ReportOptions.CreateDate = 38763.621730856480000000
ReportOptions.LastChange = 38763.621730856480000000
ScriptLanguage = 'PascalScript'
ScriptText.Strings = (
'begin'
''
'end.')
Left = 112
Top = 64
Datasets = <>
Variables = <>
Style = <>
end
end
Комментарии