📄 dbgridehimpexp.int
字号:
----------------
Unassigned, skip value
ftUnknown, ftCursor, ftADT, ftArray, ftReference, ftDataSet, ftVariant,
ftInterface, ftIDispatch,
Byte | 0 |
------
Contents | 1 |
------
|Type|
----------------
NULL
Byte | 0 |
------
Contents | 2 |
------
|Type|
----------------
INTEGER32
ftSmallint, ftInteger, ftWord, ftBoolean, ftAutoInc
Byte | 0 | 0 1 2 3 |
--------------------------
Contents | 3 | X | X | X | X |
--------------------------
|Type| Intetger value |
| (Longint) |
----------------
FLOAT64
ftFloat, ftCurrency, ftBCD, ftDate, ftTime, ftDateTime,
Byte | 0 | 0 1 2 3 4 5 6 7 |
----------------------------------------------
Contents | 4 | X | X | X | X | X | X | X | X |
----------------------------------------------
|Type| Float value (Double) |
----------------
STRING
ftString, ftMemo, ftFixedChar, ftLargeint, ftOraClob, ftGuid
Byte | 0 | 0 1 2 3 | 0 1 2 ... N |
---------------------------------------------------
Contents | 5 | X | X | X | X | a | b | c | ... 0 |
---------------------------------------------------
|Type| Size (Longint) | String body including |
| null terminator |
----------------
BINARY DATA
ftBlob, ftGraphic, ftFmtMemo, ftParadoxOle, ftDBaseOle, ftOraBlob,
ftBytes, ftTypedBinary, ftVarBytes, ftWideString,
Byte | 0 | 0 1 2 3 | 0 1 2 ... N |
---------------------------------------------------
Contents | 6 | X | X | X | X | a | b | c | ... X |
---------------------------------------------------
|Type| Size (Longword) | data |
----------------
EOF (End of File)
Byte | 0 |
------
Contents | 0 |
------
|Type|
}
TVCLDBIF_BOF = packed record
Signatura: array[0..6] of AnsiChar;
Version: Byte;
ColCount: Longint;
end;
TVCLDBIF_INTEGER32 = packed record
AType: Byte;
Value: Longint;
end;
TVCLDBIF_FLOAT64 = packed record
AType: Byte;
Value: Double;
end;
TVCLDBIF_STRING = packed record
AType: Byte;
Size: Longint;
end;
TVCLDBIF_BINARY_DATA = packed record
AType: Byte;
Size: Longint;
end;
const
TVCLDBIF_TYPE_EOF = 0;
TVCLDBIF_TYPE_UNASSIGNED = 1;
TVCLDBIF_TYPE_NULL = 2;
TVCLDBIF_TYPE_INTEGER32 = 3;
TVCLDBIF_TYPE_FLOAT64 = 4;
TVCLDBIF_TYPE_STRING = 5;
TVCLDBIF_TYPE_BINARY_DATA = 6;
type
TDBGridEhExportAsVCLDBIF = class(TDBGridEhExport)
private
// function CalcColCount:Word;
procedure WriteUnassigned;
procedure WriteNull;
procedure WriteInteger(AValue: Longint);
procedure WriteFloat(AValue: Double);
procedure WriteString(AValue: String);
procedure WriteBinaryData(AValue: String);
protected
procedure WritePrefix; override;
procedure WriteSuffix; override;
procedure WriteDataCell(Column: TColumnEh; FColCellParamsEh: TColCellParamsEh); override;
end;
{ TDBGridEhImport }
TDBGridEhImport = class(TObject)
private
FDBGridEh: TCustomDBGridEh;
FStream: TStream;
FImpCols: TColumnsEhList;
protected
Eos: Boolean;
procedure ReadPrefix; virtual;
procedure ReadSuffix; virtual;
procedure ReadRecord(ColumnsList: TColumnsEhList); virtual;
procedure ReadDataCell(Column: TColumnEh); virtual;
property Stream: TStream read FStream write FStream;
property ImpCols: TColumnsEhList read FImpCols write FImpCols;
public
constructor Create; virtual;
procedure ImportFromStream(AStream: TStream; IsImportAll: Boolean); virtual;
procedure ImportFromFile(FileName: String; IsImportAll: Boolean); virtual;
property DBGridEh: TCustomDBGridEh read FDBGridEh write FDBGridEh;
end;
TDBGridEhImportClass = class of TDBGridEhImport;
{ TDBGridEhImportAsText }
TImportTextSreamState = (itssChar, itssTab, itssNewLine, itssEof);
TDBGridEhImportAsText = class(TDBGridEhImport)
private
FLastChar: Char;
FLastState: TImportTextSreamState;
FLastString: String;
FIgnoreAll: Boolean;
function GetChar(var ch: Char): Boolean;
function CheckState: TImportTextSreamState;
function GetString(var Value: String): TImportTextSreamState;
protected
procedure ReadPrefix; override;
procedure ReadRecord(ColumnsList: TColumnsEhList); override;
procedure ReadDataCell(Column: TColumnEh); override;
public
procedure ImportFromStream(AStream: TStream; IsImportAll: Boolean); override;
end;
{ TDBGridEhImportAsVCLDBIF }
TDBGridEhImportAsVCLDBIF = class(TDBGridEhImport)
private
Prefix: TVCLDBIF_BOF;
FIgnoreAll: Boolean;
LastValue: Variant;
FieldNames: TStringList;
UseFieldNames: Boolean;
procedure ReadValue;
protected
procedure ReadPrefix; override;
procedure ReadRecord(ColumnsList: TColumnsEhList); override;
procedure ReadDataCell(Column: TColumnEh); override;
public
procedure ImportFromStream(AStream: TStream; IsImportAll: Boolean); override;
end;
{ Routines to import/export DBGridEh to/from file/stream }
procedure SaveDBGridEhToExportFile(ExportClass: TDBGridEhExportClass;
DBGridEh: TCustomDBGridEh; const FileName: String; IsSaveAll: Boolean);
procedure WriteDBGridEhToExportStream(ExportClass: TDBGridEhExportClass;
DBGridEh: TCustomDBGridEh; Stream: TStream; IsSaveAll: Boolean);
procedure LoadDBGridEhFromImportFile(ImportClass: TDBGridEhImportClass;
DBGridEh: TCustomDBGridEh; const FileName: String; IsLoadToAll: Boolean);
procedure ReadDBGridEhFromImportStream(ImportClass: TDBGridEhImportClass;
DBGridEh: TCustomDBGridEh; Stream: TStream; IsLoadToAll: Boolean);
{ Routines to support clipboard for DBGridEh }
var
CF_VCLDBIF: Word;
var
ExtendedVCLDBIFImpExpRowSelect: Boolean = True;
DBGridEhImpExpCsvSeparator: Char = ';';
procedure DBGridEh_DoCutAction(DBGridEh: TCustomDBGridEh; ForWholeGrid: Boolean);
procedure DBGridEh_DoCopyAction(DBGridEh: TCustomDBGridEh; ForWholeGrid: Boolean);
procedure DBGridEh_DoPasteAction(DBGridEh: TCustomDBGridEh; ForWholeGrid: Boolean);
procedure DBGridEh_DoDeleteAction(DBGridEh: TCustomDBGridEh; ForWholeGrid: Boolean);
implementation
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -