问题已解决,解决方法如下:
var MSExcel: Variant;
i, j,VL_I: Integer;
filename: string;
F: TextFile;
begin
if OpenDialog1.Execute then
begin
filename := OpenDialog1.FileName; { Read the first line out of the file }
end;
//从Excel文件里读取信息
MSExcel := CreateOLEObject('Excel.Application');
MSExcel.WorkBooks.Open(filename); //从有数据的行逐行读入数据<br>
for i := 1 to ClientDataSet1.RecordCount do
begin
for j := 1 to ClientDataSet1.FieldCount - 1 do
MSExcel.Cells[i, j].value := ClientDataSet1.Fields[j-1].AsString;
end;
MSExcel.Visible :=true;
var MSExcel: Variant;
i, j,VL_I: Integer;
filename: string;
F: TextFile;
begin
if OpenDialog1.Execute then
begin
filename := OpenDialog1.FileName; { Read the first line out of the file }
end;
//从Excel文件里读取信息
MSExcel := CreateOLEObject('Excel.Application');
MSExcel.WorkBooks.Open(filename); //从有数据的行逐行读入数据<br>
for i := 1 to ClientDataSet1.RecordCount do
begin
for j := 1 to ClientDataSet1.FieldCount - 1 do
MSExcel.Cells[i, j].value := ClientDataSet1.Fields[j-1].AsString;
end;
MSExcel.Visible :=true;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货