⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qimport3wizard.pas

📁 EMS Advanced Import Component Suite 允许你把数据从文件导入数据库中
💻 PAS
📖 第 1 页 / 共 5 页
字号:
unit QImport3Wizard;

{$I VerCtrl.inc}

interface
                          
uses
  QImport3XMLDoc, Forms, Dialogs, QImport3XLS, QImport3ASCII, QImport3, QImport3DBF, 
  Windows, Grids, ComCtrls, Buttons, Controls, ExtCtrls, Classes, Db, ToolWin,
  fuQImport3ProgressDlg, QImport3TXTView, DBGrids, XLSFile3, XLSMapParser3, StdCtrls,
  InfoPanel3, QImport3HTML, QImport3XML, QImport3Xlsx, QImport3Docx, QImport3ODS,
  QImport3ODT, Menus, Graphics, ADO_QImport3Access, QImport3StrTypes
  {$IFDEF VCL4}, ImgList {$ENDIF};

type
  TQImport3Wizard = class(TComponent)
  private
    FAllowedImports: TAllowedImports;

    FDataSet: TDataSet;
    FDBGrid: TDBGrid;
    FListView: TListView;
    FStringGrid: TStringGrid;

    FFileName: qiString;
    FFormats: TQImportFormats;
    FFieldFormats: TQImportFieldFormats;
    FAbout: string;
    FVersion: string;

    FImportRecCount: Integer;
    FCommitRecCount: Integer;
    FCommitAfterDone: boolean;
    FErrorLog: boolean;
    FErrorLogFileName: qiString;
    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: qiString;
    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: qiString 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: qiString 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: qiString 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;

  TQImport3WizardF = class(TForm)
    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;
    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;
    pbDBFAdd: TPaintBox;
    pbDBFAutoFill: TPaintBox;
    pbDBFRemove: TPaintBox;
    pbDBFClear: TPaintBox;
    lvCSVFields: TListView;
    tbCSV: TToolBar;
    tbtCSVAutoFill: TToolButton;
    tbtCSVClear: TToolButton;
    laCSVSkipLines: TLabel;
    edtCSVSkipLines: TEdit;
    cbCSVColNumber: TComboBox;
    laCSVColNumber: TLabel;
    lvTXTFields: TListView;
    tbTXT: TToolBar;
    tbtTXTClear: TToolButton;
    laXLSSkipCols: TLabel;
    edXLSSkipCols: TEdit;
    laXLSSkipRows: TLabel;
    edXLSSkipRows: TEdit;
    rbtXML: TRadioButton;
    tsXMLOptions: TTabSheet;
    laStep_05: TLabel;
    Bevel8: TBevel;
    lvXMLDataSet: TListView;
    lvXML: TListView;
    lvXMLMap: TListView;
    bXMLAdd: TSpeedButton;
    pbXMLAdd: TPaintBox;
    bXMLAutoFill: TSpeedButton;
    pbXMLAutoFill: TPaintBox;
    bXMLRemove: TSpeedButton;
    pbXMLRemove: TPaintBox;
    bXMLClear: TSpeedButton;
    pbXMLClear: TPaintBox;
    mmBooleanTrue: TMemo;
    laBooleanTrue: TLabel;
    mmBooleanFalse: TMemo;
    laBooleanFalse: TLabel;
    laNullValues: TLabel;
    mmNullValues: TMemo;
    tbtXLSClearAllRanges: TToolButton;
    lvXLSSelection: TListView;
    lvReplacements: TListView;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -