EXCEL?简单,我的一段代码:
var
Templete: Variant;
MsExcel:Variant;
MsExcelWorkBook:Variant;
i:integer;
begin
file://Create OLE link
Showmessage('可能需要等待一些时间,按确定开始执行报表!');
Templete := ReadRpt + RPT_COMPACT1;
try
MsExcel:=CreateOleObject('Excel.Application.8');
MsExcelWorkBook:=MsExcel.WorkBooks.Add(Templete);
except
Showmessage('请先安装 Microsoft Excel 97 或更高版本。');
exit;
end;
Screen.Cursor := crHourGlass;
file://ID
MsExcelWorkbook.ActiveSheet.Range['H3'].Value := AQCompactMain.Fields[0].AsString;
file://Date
MsExcelWorkbook.ActiveSheet.Range['H4'].Value := AQCompactMain.Fields[2].AsString;
MsExcel.Visible := true;