我靠,你这50分还正难拿!方法如下:
uses ..., Excel97;
...
procedure ...;
var
xl: TExcelApplication;
wb: _Workbook;
ws: _WorkSheet;
rg: Range;
begin
xl := TApplication.Create(Application);
try
xl.Visible[SysLocale.DefaultLCID] := True;
// 根据需要新建或打开,这里新建一个WorkSheet
wb := xl.ActiveWorkbook;
if wb = nil then
wb := xl.Workbooks.Add(Null, SysLocale.DefaultLCID);
wb.Sheets.Add(Null, Null, 1, Null, SysLocale.DefaultLCID);
ws := wb.Sheets[1];
rg := ws.Cells.Resize[1,1];
......
finally
xl.Free;
end;
end;
进一步的细节自己去读$Delphi/Ocx/Servers/Excel97.Pas