📄 qimport2wizard.pas
字号:
unit QImport2Wizard;
{$I VerCtrl.inc}
interface
uses
Forms, Dialogs, QImport2XLS, QImport2ASCII, QImport2, QImport2DBF, StdCtrls,
Grids, ComCtrls, Buttons, Controls, ExtCtrls, Classes, Db,
Windows, fuQImport2ProgressDlg, QImport2TXTView, DBGrids, XLSFile,
XLSMapParser, InfoPanel, QImport2XML, ToolWin, Graphics
{$IFDEF VCL4}, ImgList{$ENDIF};
type
TQImport2Wizard = 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;
TQImport2WizardF = class(TForm)
impDBF: TQImport2DBF;
impASCII: TQImport2ASCII;
impXLS: TQImport2XLS;
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;
laTXTSkipLines: TLabel;
edtTXTSkipLines: TEdit;
laStep_03: TLabel;
Bevel3: TBevel;
lstDBFDataSet: TListView;
lstDBF: TListView;
lstDBFMap: TListView;
bDBFAdd: TSpeedButton;
bDBFRemove: TSpeedButton;
laStep_04: TLabel;
Bevel4: TBevel;
laStep_02: TLabel;
Bevel5: TBevel;
tsFormats: TTabSheet;
laStep_06: TLabel;
Bevel7: TBevel;
pgFormats: TPageControl;
tshBaseFormats: TTabSheet;
grpDateTimeFormats: TGroupBox;
laShortDateFormat: TLabel;
laLongDateFormat: TLabel;
laShortTimeFormat: TLabel;
laLongTimeFormat: TLabel;
edtShortDateFormat: TEdit;
edtLongDateFormat: TEdit;
edtShortTimeFormat: TEdit;
edtLongTimeFormat: TEdit;
tshDataFormats: TTabSheet;
lstFormatFields: TListView;
ilWizard: TImageList;
odTemplate: TOpenDialog;
btnSaveTemplate: TSpeedButton;
sdTemplate: TSaveDialog;
bDBFAutoFill: TSpeedButton;
bDBFClear: TSpeedButton;
laQuote: TLabel;
tsCSVOptions: TTabSheet;
laStep_07: TLabel;
Bevel15: TBevel;
sgrCSV: TStringGrid;
pgFieldOptions: TPageControl;
tsFieldTuning: TTabSheet;
laGeneratorValue: TLabel;
edtGeneratorValue: TEdit;
laGeneratorStep: TLabel;
edtGeneratorStep: TEdit;
laConstantValue: TLabel;
edtConstantValue: TEdit;
laNullValue: TLabel;
edtNullValue: TEdit;
laDefaultValue: TLabel;
edtDefaultValue: TEdit;
laLeftQuote: TLabel;
edtLeftQuote: TEdit;
laRightQuote: TLabel;
edtRightQuote: TEdit;
laQuoteAction: TLabel;
cmbQuoteAction: TComboBox;
laCharCase: TLabel;
cmbCharCase: TComboBox;
laCharSet: TLabel;
cmbCharSet: TComboBox;
Bevel13: TBevel;
grpSeparators: TGroupBox;
laDecimalSeparator: TLabel;
edtDecimalSeparator: TEdit;
laThousandSeparator: TLabel;
edtThousandSeparator: TEdit;
laDateSeparator: TLabel;
edtDateSeparator: TEdit;
laTimeSeparator: TLabel;
edtTimeSeparator: TEdit;
cbQuote: TComboBox;
pcLastStep: TPageControl;
tshCommit: TTabSheet;
tshAdvanced: 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;
chDBFSkipDeleted: TCheckBox;
sdErrorLog: TSaveDialog;
chCloseAfterImport: TCheckBox;
pcXLSFile: TPageControl;
paXLSFieldsAndRanges: TPanel;
lvXLSFields: TListView;
lvXLSRanges: TListView;
tbXLSRanges: TToolBar;
tbtXLSAddRange: TToolButton;
tbtXLSEditRange: TToolButton;
tbtXLSDelRange: TToolButton;
tbXLSUtils: TToolBar;
tbtXLSAutoFillCols: TToolButton;
tbtXLSAutoFillRows: TToolButton;
tbtXLSMoveRangeUp: TToolButton;
tbtXLSMoveRangeDown: TToolButton;
tbtSeparator_01: TToolButton;
tbtXLSClearFieldRanges: TToolButton;
grpErrorLog: TGroupBox;
laErrorLogFileName: TLabel;
bvErrorLogFileName: TBevel;
bErrorLogFileName: TSpeedButton;
chEnableErrorLog: TCheckBox;
chShowErrorLog: TCheckBox;
edErrorLogFileName: TEdit;
chRewriteErrorLogFile: TCheckBox;
rgImportMode: TRadioGroup;
lvAvailableColumns: TListView;
laAvailableColumns: TLabel;
bAllToRight: TSpeedButton;
bOneToRirght: TSpeedButton;
bOneToLeft: TSpeedButton;
bAllToLeft: TSpeedButton;
lvSelectedColumns: TListView;
laSelectedColumns: TLabel;
rgAddType: TRadioGroup;
laReplacements: TLabel;
gbTemplateOptions: TGroupBox;
btnLoadTemplate: TSpeedButton;
chGoToLastPage: TCheckBox;
chAutoSaveTemplate: TCheckBox;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -