You've already forked lazarus-ccr
TRxDBGridExportSpreadSheet - create export setup form
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3376 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -868,18 +868,21 @@ type
|
|||||||
private
|
private
|
||||||
FOnAfterExecute: TNotifyEvent;
|
FOnAfterExecute: TNotifyEvent;
|
||||||
FOnBeforeExecute: TNotifyEvent;
|
FOnBeforeExecute: TNotifyEvent;
|
||||||
|
FShowSetupForm: boolean;
|
||||||
procedure ExecTools(Sender:TObject);
|
procedure ExecTools(Sender:TObject);
|
||||||
protected
|
protected
|
||||||
FRxDBGrid: TRxDBGrid;
|
FRxDBGrid: TRxDBGrid;
|
||||||
FCaption:string;
|
FCaption:string;
|
||||||
procedure SetRxDBGrid(AValue: TRxDBGrid);
|
procedure SetRxDBGrid(AValue: TRxDBGrid);
|
||||||
function DoExecTools:boolean; virtual;
|
function DoExecTools:boolean; virtual;
|
||||||
|
function DoSetupTools:boolean; virtual;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
function Execute:boolean;
|
function Execute:boolean;
|
||||||
published
|
published
|
||||||
property RxDBGrid:TRxDBGrid read FRxDBGrid write SetRxDBGrid;
|
property RxDBGrid:TRxDBGrid read FRxDBGrid write SetRxDBGrid;
|
||||||
property Caption:string read FCaption write FCaption;
|
property Caption:string read FCaption write FCaption;
|
||||||
|
property ShowSetupForm:boolean read FShowSetupForm write FShowSetupForm default false;
|
||||||
property OnBeforeExecute:TNotifyEvent read FOnBeforeExecute write FOnBeforeExecute;
|
property OnBeforeExecute:TNotifyEvent read FOnBeforeExecute write FOnBeforeExecute;
|
||||||
property OnAfterExecute:TNotifyEvent read FOnAfterExecute write FOnAfterExecute;
|
property OnAfterExecute:TNotifyEvent read FOnAfterExecute write FOnAfterExecute;
|
||||||
end;
|
end;
|
||||||
@@ -1002,6 +1005,11 @@ begin
|
|||||||
//
|
//
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TRxDBGridAbstractTools.DoSetupTools: boolean;
|
||||||
|
begin
|
||||||
|
Result:=true;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRxDBGridAbstractTools.ExecTools(Sender: TObject);
|
procedure TRxDBGridAbstractTools.ExecTools(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
Execute;
|
Execute;
|
||||||
@@ -1011,13 +1019,21 @@ constructor TRxDBGridAbstractTools.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FCaption:=Name;
|
FCaption:=Name;
|
||||||
|
FShowSetupForm:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TRxDBGridAbstractTools.Execute: boolean;
|
function TRxDBGridAbstractTools.Execute: boolean;
|
||||||
begin
|
begin
|
||||||
|
Result:=false;
|
||||||
if Assigned(FOnBeforeExecute) then
|
if Assigned(FOnBeforeExecute) then
|
||||||
FOnBeforeExecute(Self);
|
FOnBeforeExecute(Self);
|
||||||
|
|
||||||
|
if FShowSetupForm then
|
||||||
|
Result:=DoSetupTools;
|
||||||
|
|
||||||
|
if Result then
|
||||||
Result:=DoExecTools;
|
Result:=DoExecTools;
|
||||||
|
|
||||||
if Assigned(FOnAfterExecute) then
|
if Assigned(FOnAfterExecute) then
|
||||||
FOnAfterExecute(Self);
|
FOnAfterExecute(Self);
|
||||||
end;
|
end;
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
{ vclutils unit
|
{ RxDBGridExportSpreadSheet unit
|
||||||
|
|
||||||
Copyright (C) 2005-2013 Lagunov Aleksey alexs@yandex.ru
|
Copyright (C) 2005-2013 Lagunov Aleksey alexs@yandex.ru
|
||||||
original conception from rx library for Delphi (c)
|
original conception from rx library for Delphi (c)
|
||||||
@@ -51,9 +51,12 @@ type
|
|||||||
|
|
||||||
{ TRxDBGridExportSpeadSheet }
|
{ TRxDBGridExportSpeadSheet }
|
||||||
|
|
||||||
|
{ TRxDBGridExportSpreadSheet }
|
||||||
|
|
||||||
TRxDBGridExportSpreadSheet = class(TRxDBGridAbstractTools)
|
TRxDBGridExportSpreadSheet = class(TRxDBGridAbstractTools)
|
||||||
private
|
private
|
||||||
FFileName: string;
|
FFileName: string;
|
||||||
|
FOpenAfterExport: boolean;
|
||||||
FOptions: TRxDBGridExportSpreadSheetOptions;
|
FOptions: TRxDBGridExportSpreadSheetOptions;
|
||||||
FPageName: string;
|
FPageName: string;
|
||||||
protected
|
protected
|
||||||
@@ -69,18 +72,21 @@ type
|
|||||||
procedure DoExportFooter;
|
procedure DoExportFooter;
|
||||||
procedure DoExportColWidth;
|
procedure DoExportColWidth;
|
||||||
function DoExecTools:boolean;override;
|
function DoExecTools:boolean;override;
|
||||||
|
function DoSetupTools:boolean; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
published
|
published
|
||||||
property FileName:string read FFileName write FFileName;
|
property FileName:string read FFileName write FFileName;
|
||||||
property PageName:string read FPageName write FPageName;
|
property PageName:string read FPageName write FPageName;
|
||||||
property Options:TRxDBGridExportSpreadSheetOptions read FOptions write FOptions;
|
property Options:TRxDBGridExportSpreadSheetOptions read FOptions write FOptions;
|
||||||
|
property OpenAfterExport:boolean read FOpenAfterExport write FOpenAfterExport default false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure Register;
|
procedure Register;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
uses fpsallformats, LCLType, math, LazUTF8, rxdconst;
|
uses fpsallformats, LCLType, Forms, math, LazUTF8, rxdconst, Controls,
|
||||||
|
RxDBGridExportSpreadSheet_ParamsUnit;
|
||||||
|
|
||||||
{$R rxdbgridexportspreadsheet.res}
|
{$R rxdbgridexportspreadsheet.res}
|
||||||
|
|
||||||
@@ -246,6 +252,7 @@ constructor TRxDBGridExportSpreadSheet.Create(AOwner: TComponent);
|
|||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FCaption:=sToolsExportSpeadSheet;
|
FCaption:=sToolsExportSpeadSheet;
|
||||||
|
FOpenAfterExport:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TRxDBGridExportSpreadSheet.DoExecTools: boolean;
|
function TRxDBGridExportSpreadSheet.DoExecTools: boolean;
|
||||||
@@ -283,4 +290,37 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TRxDBGridExportSpreadSheet.DoSetupTools: boolean;
|
||||||
|
var
|
||||||
|
F:TRxDBGridExportSpreadSheet_ParamsForm;
|
||||||
|
begin
|
||||||
|
F:=TRxDBGridExportSpreadSheet_ParamsForm.Create(Application);
|
||||||
|
F.FileNameEdit1.FileName:=FFileName;
|
||||||
|
F.cbOpenAfterExport.Checked:=FOpenAfterExport;
|
||||||
|
F.cbExportColumnFooter.Checked:=ressExportFooter in FOptions;
|
||||||
|
F.cbExportColumnHeader.Checked:=ressExportTitle in FOptions;
|
||||||
|
F.cbExportCellColors.Checked:=ressExportColors in FOptions;
|
||||||
|
F.cbOverwriteExisting.Checked:=ressOverwriteExisting in FOptions;
|
||||||
|
F.edtPageName.Text:=FPageName;
|
||||||
|
|
||||||
|
Result:=F.ShowModal = mrOk;
|
||||||
|
if Result then
|
||||||
|
begin
|
||||||
|
FOpenAfterExport:=F.cbOpenAfterExport.Checked;
|
||||||
|
FFileName:=F.FileNameEdit1.FileName;
|
||||||
|
FPageName:=F.edtPageName.Text;
|
||||||
|
|
||||||
|
FOptions:=[];
|
||||||
|
if F.cbExportColumnFooter.Checked then
|
||||||
|
FOptions :=FOptions + [ressExportFooter];
|
||||||
|
if F.cbExportColumnHeader.Checked then
|
||||||
|
FOptions :=FOptions + [ressExportTitle];
|
||||||
|
if F.cbExportCellColors.Checked then
|
||||||
|
FOptions :=FOptions + [ressExportColors];
|
||||||
|
if F.cbOverwriteExisting.Checked then
|
||||||
|
FOptions :=FOptions + [ressOverwriteExisting];
|
||||||
|
end;
|
||||||
|
F.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsForm
|
object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsForm
|
||||||
Left = 732
|
Left = 732
|
||||||
Height = 266
|
Height = 267
|
||||||
Top = 338
|
Top = 338
|
||||||
Width = 548
|
Width = 548
|
||||||
Caption = 'Export params'
|
Caption = 'Export params'
|
||||||
ClientHeight = 266
|
ClientHeight = 267
|
||||||
ClientWidth = 548
|
ClientWidth = 548
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
@@ -56,11 +56,11 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
|
|||||||
end
|
end
|
||||||
object Label3: TLabel
|
object Label3: TLabel
|
||||||
AnchorSideLeft.Control = Label4
|
AnchorSideLeft.Control = Label4
|
||||||
AnchorSideTop.Control = Label2
|
AnchorSideTop.Control = cbOverwriteExisting
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 280
|
Left = 280
|
||||||
Height = 21
|
Height = 21
|
||||||
Top = 97
|
Top = 126
|
||||||
Width = 71
|
Width = 71
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Page name'
|
Caption = 'Page name'
|
||||||
@@ -72,30 +72,29 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 286
|
Left = 286
|
||||||
Height = 31
|
Height = 31
|
||||||
Top = 124
|
Top = 153
|
||||||
Width = 160
|
Width = 160
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object CheckBox1: TCheckBox
|
object cbExportColumnFooter: TCheckBox
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Label2
|
AnchorSideTop.Control = cbExportColumnHeader
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 97
|
Top = 155
|
||||||
Width = 161
|
Width = 161
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Export column footer'
|
Caption = 'Export column footer'
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object CheckBox2: TCheckBox
|
object cbOpenAfterExport: TCheckBox
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = CheckBox1
|
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 126
|
Top = 97
|
||||||
Width = 140
|
Width = 140
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Open after export'
|
Caption = 'Open after export'
|
||||||
@@ -104,7 +103,7 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
|
|||||||
object ButtonPanel1: TButtonPanel
|
object ButtonPanel1: TButtonPanel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 41
|
Height = 41
|
||||||
Top = 219
|
Top = 220
|
||||||
Width = 536
|
Width = 536
|
||||||
OKButton.Name = 'OKButton'
|
OKButton.Name = 'OKButton'
|
||||||
OKButton.DefaultCaption = True
|
OKButton.DefaultCaption = True
|
||||||
@@ -117,21 +116,21 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
|
|||||||
TabOrder = 4
|
TabOrder = 4
|
||||||
ShowButtons = [pbOK, pbCancel, pbHelp]
|
ShowButtons = [pbOK, pbCancel, pbHelp]
|
||||||
end
|
end
|
||||||
object CheckBox3: TCheckBox
|
object cbExportColumnHeader: TCheckBox
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = CheckBox2
|
AnchorSideTop.Control = cbOpenAfterExport
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 155
|
Top = 126
|
||||||
Width = 165
|
Width = 165
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Caption = 'Export column header'
|
Caption = 'Export column header'
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
end
|
end
|
||||||
object CheckBox4: TCheckBox
|
object cbExportCellColors: TCheckBox
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = CheckBox3
|
AnchorSideTop.Control = cbExportColumnFooter
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 23
|
Height = 23
|
||||||
@@ -151,4 +150,16 @@ object RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsFo
|
|||||||
Width = 1
|
Width = 1
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
|
object cbOverwriteExisting: TCheckBox
|
||||||
|
AnchorSideLeft.Control = Label4
|
||||||
|
AnchorSideTop.Control = Label2
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 280
|
||||||
|
Height = 23
|
||||||
|
Top = 97
|
||||||
|
Width = 166
|
||||||
|
BorderSpacing.Around = 6
|
||||||
|
Caption = 'Overwrite existing file'
|
||||||
|
TabOrder = 7
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
{ vclutils unit
|
{ RxDBGridExportSpreadSheet_ParamsUnit unit
|
||||||
|
|
||||||
Copyright (C) 2005-2013 Lagunov Aleksey alexs@yandex.ru
|
Copyright (C) 2005-2013 Lagunov Aleksey alexs@yandex.ru
|
||||||
original conception from rx library for Delphi (c)
|
original conception from rx library for Delphi (c)
|
||||||
@@ -45,10 +45,11 @@ type
|
|||||||
|
|
||||||
TRxDBGridExportSpreadSheet_ParamsForm = class(TForm)
|
TRxDBGridExportSpreadSheet_ParamsForm = class(TForm)
|
||||||
ButtonPanel1: TButtonPanel;
|
ButtonPanel1: TButtonPanel;
|
||||||
CheckBox1: TCheckBox;
|
cbExportColumnFooter: TCheckBox;
|
||||||
CheckBox2: TCheckBox;
|
cbOpenAfterExport: TCheckBox;
|
||||||
CheckBox3: TCheckBox;
|
cbExportColumnHeader: TCheckBox;
|
||||||
CheckBox4: TCheckBox;
|
cbExportCellColors: TCheckBox;
|
||||||
|
cbOverwriteExisting: TCheckBox;
|
||||||
edtPageName: TEdit;
|
edtPageName: TEdit;
|
||||||
FileNameEdit1: TFileNameEdit;
|
FileNameEdit1: TFileNameEdit;
|
||||||
Label1: TLabel;
|
Label1: TLabel;
|
||||||
@@ -62,9 +63,6 @@ type
|
|||||||
{ public declarations }
|
{ public declarations }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
|
||||||
RxDBGridExportSpreadSheet_ParamsForm: TRxDBGridExportSpreadSheet_ParamsForm;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
Reference in New Issue
Block a user