📄 ado_qimport3wizard.pas
字号:
unit ADO_QImport3Wizard;
{$I QImport3VerCtrl.Inc}
interface
uses
Forms, ADO_QImport3Access, Dialogs, ImgList, Controls, QImport3XLS,
QImport3ASCII, QImport3, QImport3DBF, StdCtrls, Grids, ComCtrls, Buttons,
ExtCtrls, Classes, Db, Windows, fuQImport3ProgressDlg, QImport3TXTView,
DBGrids, QImport3XML, ToolWin, XLSFile3, Graphics, XLSMapParser3, InfoPanel3;
type
TAllowedImport = (aiXLS, aiDBF, aiXML, aiTXT, aiCSV, aiAccess);
TAllowedImports = set of TAllowedImport;
TADO_QImport3Wizard = class(TComponent)
private
FAllowedImports: TAllowedImports;
FDataSet: TDataSet;
FDBGrid: TDBGrid;
FListView: TListView;
FStringGrid: TStringGrid;
FFileName: string;
FFormats: TQImportFormats;
FFieldFormats: TQImportFieldFormats;
FAbout: string;
FVersion: string;
FImportRecCount: integer;
FCommitRecCount: integer;
FCommitAfterDone: boolean;
FErrorLog: boolean;
FErrorLogFileName: string;
FRewriteErrorLogFile: boolean;
FShowErrorLog: boolean;
FShowProgress: boolean;
FAutoChangeExtension: boolean;
FShowHelpButton: boolean;
FCloseAfterImport: boolean;
FPicture: TPicture;
FTextViewerRows: integer;
FCSVViewerRows: integer;
FExcelViewerRows: integer;
FExcelMaxColWidth: integer;
FShowSaveLoadButtons: boolean;
FAutoSaveTemplate: boolean;
FAutoLoadTemplate: boolean;
FTemplateFileName: string;
FGoToLastPage: boolean;
FImportDestination: TQImportDestination;
FImportMode: TQImportMode;
FAddType: TQImportAddType;
FKeyColumns: TStrings;
FGridCaptionRow: integer;
FGridStartRow: integer;
FConfirmOnCancel: boolean;
FOnBeforeImport: TNotifyEvent;
FOnAfterImport: TNotifyEvent;
FOnImportRecord: TNotifyEvent;
FOnImportError: TNotifyEvent;
FOnImportErrorAdv: TNotifyEvent;
FOnNeedCommit: TNotifyEvent;
FOnImportCancel: TImportCancelEvent;
FOnBeforePost: TImportBeforePostEvent;
FOnLoadTemplate: TImportLoadTemplateEvent;
FOnDestinationLocate: TDestinationLocateEvent;
function IsFileName: Boolean;
procedure SetFormats(const Value: TQImportFormats);
procedure SetFieldFormats(const Value: TQImportFieldFormats);
procedure SetKeyColumns(const Value: TStrings);
procedure SetPicture(const Value: TPicture);
protected
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Execute;
published
property AllowedImports: TAllowedImports read FAllowedImports
write FAllowedImports default [Low(TAllowedImport)..High(TAllowedImport)];
property DataSet: TDataSet read FDataSet write FDataSet;
property DBGrid: TDBGrid read FDBGrid write FDBGrid;
property ListView: TListView read FListView write FListView;
property StringGrid: TStringGrid read FStringGrid write FStringGrid;
property FileName: string read FFileName write FFileName stored IsFileName;
property Formats: TQImportFormats read FFormats write SetFormats;
property FieldFormats: TQImportFieldFormats read FFieldFormats
write SetFieldFormats;
property About: string read FAbout write FAbout;
property Version: string read FVersion write FVersion;
property ImportRecCount: integer read FImportRecCount
write FImportRecCount default 0;
property CommitRecCount: integer read FCommitRecCount
write FCommitRecCount default 100;
property CommitAfterDone: boolean read FCommitAfterDone
write FCommitAfterDone default true;
property ErrorLog: boolean read FErrorLog write FErrorLog default false;
property ErrorLogFileName: string read FErrorLogFileName
write FErrorLogFileName;
property RewriteErrorLogFile: boolean read FRewriteErrorLogFile
write FRewriteErrorLogFile default true;
property ShowErrorLog: boolean read FShowErrorLog
write FShowErrorLog default false;
property ShowProgress: boolean read FShowProgress
write FShowProgress default true;
property AutoChangeExtension: boolean read FAutoChangeExtension
write FAutoChangeExtension default true;
property ShowHelpButton: boolean read FShowHelpButton
write FShowHelpButton default true;
property CloseAfterImport: boolean read FCloseAfterImport
write FCloseAfterImport default false;
property Picture: TPicture read FPicture write SetPicture;
property TextViewerRows: integer read FTextViewerRows
write FTextViewerRows default 20;
property CSVViewerRows: integer read FCSVViewerRows
write FCSVViewerRows default 20;
property ExcelViewerRows: integer read FExcelViewerRows
write FExcelViewerRows default 256;
property ExcelMaxColWidth: integer read FExcelMaxColWidth
write FExcelMaxColWidth default 130;
property ShowSaveLoadButtons: boolean read FShowSaveLoadButtons
write FShowSaveLoadButtons default false;
property TemplateFileName: string read FTemplateFileName
write FTemplateFileName;
property AutoLoadTemplate: boolean read FAutoLoadTemplate
write FAutoLoadTemplate default false;
property AutoSaveTemplate: boolean read FAutoSaveTemplate
write FAutoSaveTemplate default false;
property GoToLastPage: boolean read FGoToLastPage
write FGoToLastPage default false;
property ImportDestination: TQImportDestination read FImportDestination
write FImportDestination default qidDataSet;
property ImportMode: TQImportMode read FImportMode write FImportMode
default qimInsertAll;
property AddType: TQImportAddType read FAddType
write FAddType default qatAppend;
property KeyColumns: TStrings read FKeyColumns write SetKeyColumns;
property GridCaptionRow: integer read FGridCaptionRow
write FGridCaptionRow default -1;
property GridStartRow: integer read FGridStartRow
write FGridStartRow default -1;
property ConfirmOnCancel: boolean read FConfirmOnCancel
write FConfirmOnCancel default true;
property OnBeforeImport: TNotifyEvent read FOnBeforeImport
write FOnBeforeImport;
property OnAfterImport: TNotifyEvent read FOnAfterImport
write FOnAfterImport;
property OnImportRecord: TNotifyEvent read FOnImportRecord
write FOnImportRecord;
property OnImportError: TNotifyEvent read FOnImportError
write FOnImportError;
property OnImportErrorAdv: TNotifyEvent read FOnImportErrorAdv
write FOnImportErrorAdv;
property OnNeedCommit: TNotifyEvent read FOnNeedCommit
write FOnNeedCommit;
property OnImportCancel: TImportCancelEvent read FOnImportCancel
write FOnImportCancel;
property OnBeforePost: TImportBeforePostEvent read FOnBeforePost
write FOnBeforePost;
property OnLoadTemplate: TImportLoadTemplateEvent read FOnLoadTemplate
write FOnLoadTemplate;
property OnDestinationLocate: TDestinationLocateEvent
read FOnDestinationLocate write FOnDestinationLocate;
end;
TADO_QImport3WizardF = class(TForm)
impDBF: TQImport3DBF;
impASCII: TQImport3ASCII;
impXLS: TQImport3XLS;
paButtons: TPanel;
Bevel1: TBevel;
bHelp: TButton;
bBack: TButton;
bNext: TButton;
bCancel: TButton;
bOk: TButton;
pgImport: TPageControl;
tsImportType: TTabSheet;
tsTXTOptions: TTabSheet;
tsDBFOptions: TTabSheet;
tsExcelOptions: TTabSheet;
grpImportTypes: TGroupBox;
laComma: TLabel;
rbtXLS: TRadioButton;
rbtDBF: TRadioButton;
rbtTXT: TRadioButton;
rbtCSV: TRadioButton;
cbComma: TComboBox;
laSourceFileName: TLabel;
edtFileName: TEdit;
Bevel6: TBevel;
opnDialog: TOpenDialog;
spbBrowse: TSpeedButton;
tsCommitOptions: TTabSheet;
laTXTStep_02: TLabel;
Bevel2: TBevel;
laStep_03: TLabel;
Bevel3: TBevel;
lstDBFDataSet: TListView;
lstDBF: TListView;
lstDBFMap: TListView;
laStep_04: TLabel;
Bevel4: TBevel;
laStep_02: TLabel;
Bevel5: TBevel;
tsFormats: TTabSheet;
laStep_06: TLabel;
Bevel7: TBevel;
odTemplate: TOpenDialog;
sdTemplate: TSaveDialog;
laQuote: TLabel;
rbtAccess: TRadioButton;
tsAccessOptions_01: TTabSheet;
odQuery: TOpenDialog;
sdQuery: TSaveDialog;
rbtAccessTable: TRadioButton;
rbtAccessSQL: TRadioButton;
lbAccessTables: TListBox;
memAccessSQL: TMemo;
tsAccessOptions_02: TTabSheet;
Bevel15: TBevel;
laStep_07: TLabel;
Bevel16: TBevel;
laStep_08: TLabel;
lstAccessDataSet: TListView;
lstAccess: TListView;
lstAccessMap: TListView;
ImpAccess: TADO_QImport3Access;
tsCSVOptions: TTabSheet;
Label1: TLabel;
Bevel17: TBevel;
cbQuote: TComboBox;
chDBFSkipDeleted: TCheckBox;
sdErrorLog: TSaveDialog;
impXML: TQImport3XML;
gbTemplateOptions: TGroupBox;
btnLoadTemplate: TSpeedButton;
chGoToLastPage: TCheckBox;
chAutoSaveTemplate: TCheckBox;
rbtXML: TRadioButton;
tbTXT: TToolBar;
tbtTXTClear: TToolButton;
lvTXTFields: TListView;
laTXTSkipLines: TLabel;
edtTXTSkipLines: TEdit;
ilWizard: TImageList;
bDBFAdd: TSpeedButton;
pbDBFAdd: TPaintBox;
bDBFAutoFill: TSpeedButton;
pbDBFAutoFill: TPaintBox;
bDBFRemove: TSpeedButton;
pbDBFRemove: TPaintBox;
bDBFClear: TSpeedButton;
pbDBFClear: TPaintBox;
tbXLSUtils: TToolBar;
tbtXLSAutoFillCols: TToolButton;
tbtXLSAutoFillRows: TToolButton;
tbtXLSClearAllRanges: TToolButton;
paXLSFieldsAndRanges: TPanel;
lvXLSFields: TListView;
lvXLSRanges: TListView;
tbXLSRanges: TToolBar;
tbtXLSAddRange: TToolButton;
tbtXLSEditRange: TToolButton;
tbtXLSDelRange: TToolButton;
tbtSeparator_01: TToolButton;
tbtXLSMoveRangeUp: TToolButton;
tbtXLSMoveRangeDown: TToolButton;
laXLSSkipCols: TLabel;
edXLSSkipCols: TEdit;
laXLSSkipRows: TLabel;
edXLSSkipRows: TEdit;
pcXLSFile: TPageControl;
pcLastStep: TPageControl;
tshCommit: TTabSheet;
grpImportCount: TGroupBox;
laImportRecCount_01: TLabel;
laImportRecCount_02: TLabel;
chImportAllRecords: TCheckBox;
edtImportRecCount: TEdit;
grpCommit: TGroupBox;
laCommitRecCount_01: TLabel;
laCommitRecCount_02: TLabel;
chCommitAfterDone: TCheckBox;
edtCommitRecCount: TEdit;
chCloseAfterImport: TCheckBox;
tbtXLSClearFieldRanges: TToolButton;
grpErrorLog: TGroupBox;
laErrorLogFileName: TLabel;
bvErrorLogFileName: TBevel;
bErrorLogFileName: TSpeedButton;
chEnableErrorLog: TCheckBox;
chShowErrorLog: TCheckBox;
edErrorLogFileName: TEdit;
chRewriteErrorLogFile: TCheckBox;
tshAdvanced: TTabSheet;
laAvailableColumns: TLabel;
bAllToRight: TSpeedButton;
bOneToRirght: TSpeedButton;
bOneToLeft: TSpeedButton;
bAllToLeft: TSpeedButton;
laSelectedColumns: TLabel;
rgImportMode: TRadioGroup;
lvAvailableColumns: TListView;
lvSelectedColumns: TListView;
rgAddType: TRadioGroup;
btnSaveTemplate: TSpeedButton;
pgFormats: TPageControl;
tshBaseFormats: TTabSheet;
grpDateTimeFormats: TGroupBox;
laShortDateFormat: TLabel;
laLongDateFormat: TLabel;
laShortTimeFormat: TLabel;
laLongTimeFormat: TLabel;
edtShortDateFormat: TEdit;
edtLongDateFormat: TEdit;
edtShortTimeFormat: TEdit;
edtLongTimeFormat: TEdit;
grpSeparators: TGroupBox;
laDecimalSeparator: TLabel;
laThousandSeparator: TLabel;
laDateSeparator: TLabel;
laTimeSeparator: TLabel;
edtDecimalSeparator: TEdit;
edtThousandSeparator: TEdit;
edtDateSeparator: TEdit;
edtTimeSeparator: TEdit;
tshDataFormats: TTabSheet;
lstFormatFields: TListView;
pgFieldOptions: TPageControl;
tsFieldTuning: TTabSheet;
Bevel13: TBevel;
laGeneratorValue: TLabel;
laGeneratorStep: TLabel;
laConstantValue: TLabel;
laNullValue: TLabel;
laDefaultValue: TLabel;
laLeftQuote: TLabel;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -