A
asdfg1234
Unregistered / Unconfirmed
GUEST, unregistred user!
var
aSheet:Variant;
i:integer;
begin
ExcelApplication1.Visible[0]:=True;
ExcelApplication1.WorkBooks.Add(xlWBATWorksheet,1);
aSheet:=ExcelApplication1.Worksheets.Item[1];
aSheet.cells[1,1].Value:='日期';
aSheet.cells[1,2].Value:='时间';
aSheet.cells[1,3].Value:='顺序号';
i:=2;
with adoquery1 do
begin
sql.clear;
SQL.Add('select DTE,TIM,REF');
SQL.Add(' from abc');
SQL.Add(' where DTE>=cast('''+edit1.Text+''' as decimal(8))');
SQL.Add(' and DTE<=cast('''+edit2.Text+''' as decimal(8))');
close;
open;
first;
while not eof do begin
aSheet.cells[i,1].Value:=FieldbyName('DTE').AsString;
aSheet.cells[i,2].Value:=FieldbyName('TIM').AsString;
aSheet.cells[i,3].Value:=FieldbyName('REF').AsString;
i:=i+1;
next;
end;
ExcelApplication1.save('abc.xls');
ExcelApplication1.Quit;
end;
aSheet:Variant;
i:integer;
begin
ExcelApplication1.Visible[0]:=True;
ExcelApplication1.WorkBooks.Add(xlWBATWorksheet,1);
aSheet:=ExcelApplication1.Worksheets.Item[1];
aSheet.cells[1,1].Value:='日期';
aSheet.cells[1,2].Value:='时间';
aSheet.cells[1,3].Value:='顺序号';
i:=2;
with adoquery1 do
begin
sql.clear;
SQL.Add('select DTE,TIM,REF');
SQL.Add(' from abc');
SQL.Add(' where DTE>=cast('''+edit1.Text+''' as decimal(8))');
SQL.Add(' and DTE<=cast('''+edit2.Text+''' as decimal(8))');
close;
open;
first;
while not eof do begin
aSheet.cells[i,1].Value:=FieldbyName('DTE').AsString;
aSheet.cells[i,2].Value:=FieldbyName('TIM').AsString;
aSheet.cells[i,3].Value:=FieldbyName('REF').AsString;
i:=i+1;
next;
end;
ExcelApplication1.save('abc.xls');
ExcelApplication1.Quit;
end;