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