unigui導出EXCEL使用NATIVEEXCEL
阿新 • • 發佈:2017-09-09
ise roc orm nis exp fin ive all implement Exit;
f := ‘1.xls‘;
xls := TDataset2Excel.Create(nil);
try
xls.Dataset := dataset;
xls.WorksheetName := ‘1‘;
xls.SaveDatasetAs(f);
xls.Workbook := nil;
MainForm.uniApplication.UniSession.SendFile(f, f);
finally
xls.Free;
end;
end;
unigui導出EXCEL使用NATIVEEXCEL
// 需要nativeexcel控件
// cxg 2017-9-9
unit myExcel;
interface
uses
System.SysUtils, db,
Dataset2Excel;
procedure exportXLS(dataset: TDataSet);
implementation
uses
Main;
procedure exportXLS(dataset: TDataSet);
var
xls: TDataset2Excel;
f: string;
begin
if dataset = nil then
f := ‘1.xls‘;
xls := TDataset2Excel.Create(nil);
try
xls.Dataset := dataset;
xls.WorksheetName := ‘1‘;
xls.SaveDatasetAs(f);
xls.Workbook := nil;
MainForm.uniApplication.UniSession.SendFile(f, f);
finally
xls.Free;
end;
end;
end.
unigui導出EXCEL使用NATIVEEXCEL