|
begin
Result := _asFieldName.Count;
end;
function TXlsExpAdapter.GetXlsTitle(const iniIndex : Integer) : string;
begin
if (iniIndex >= 0) and (iniIndex <= _aDataType.Count-1) then
begin
Result := _asXlsTitle[iniIndex];
end;
end;
function TXlsExpAdapter.GetFieldName(const iniIndex : Integer) : string;
begin
if (iniIndex >= 0) and (iniIndex <= _aDataType.Count-1) then
begin
Result := _asFieldName[iniIndex];
end;
end;
function TXlsExpAdapter.GetDataType(const iniIndex : Integer) : TDataType;
begin
if (iniIndex >= 0) and (iniIndex <= _aDataType.Count-1) then
begin
Result := TDataType(_aDataType[iniIndex]);
end;
end;
procedure TXlsExpAdapter.GetInfoFromDBGrid(const ingrid : TDBGrid);
var
i, j : Integer;
dt : TDataType;
begin
for i := 0 to ingrid.Columns.Count-1 do
begin
if ingrid.Columns[i].Visible then
begin
dt := ftUnknown;
for j := 0 to ingrid.FieldCount-1 do
begin
if ingrid.Columns[i].FieldName = ingrid.Fields[j].FieldName then
begin
dt := ingrid.Fields[j].DataType;
Break;
end;
end;
Self.AddField(ingrid.Columns[i].FieldName, ingrid.Columns[i].Title.Caption, dt);
end;
end;
end;
procedure TXlsExpAdapter.AddField(const insFieldName, insCaption : string; const intype : TDataType = ftUnKnown);
var
iIndex : Integer;
begin
iIndex := _asFieldName.IndexOf(insFieldName);
if iIndex = -1 then
begin
_asFieldName.Add(insFieldName);
_asXlsTitle.Add(insCaption);
_aDataType.Add(TObject(intype));
end
else begin
_asFieldName[iIndex] := insFieldName;
_asXlsTitle[iIndex] := insCaption;
_aDataType[iIndex] := TObject(intype);
end;
end;
constructor TXlsExpAdapter.Create();
begin
_asFieldName := TStringList.Create();
_asXlsTitle := TStringList.Create();
_aDataType := TObjectList.Create();
end;
destructor TXlsExpAdapter.Destroy();
begin
end;
function TManagedDataSet.ExportToXls(const inadapter : TXlsExpAdapter) : Boolean;
var
excelobj : OleVariant;
i : Integer;
begin
Result := False;
if not Self.Active then
Exit;
&nb 上一页 [1] [2] [3] [4] 下一页 [VB.NET程序]VB的ShowInTaskbar功能分析以及用VC的实现 [Delphi程序]TFontNameComboBox及TFontSizeComboBox的实现 [Delphi程序]MSN / QQ 中的动画表情 在Delphi中RichEdit的实现… [VB.NET程序]MD5加密算法(16位,32位)的C#,VB的实现 [Web开发]利用JS获取IE客户端IP及MAC的实现 [Web开发]ASP.Net ViewState的实现 [Web开发]vb.net_asp.net跨栏表头_滚动表体的DataGrid的实现 [Web开发]无限分类算法 js 的实现 [JAVA开发]关于UDDI的实现 [SyBase]InnoDB 中文参考手册 --- 10 multiversioning 的实…
|