Com+ 匯出excel 格式
阿新 • • 發佈:2018-12-21
Uses ComObj;
var
xlapp: variant;
begin
if not VarIsEmpty(xlapp) then
begin
xlapp.DisplayAlerts := False;
xlapp.Quit;
VarClear(xlapp);
end;
try
xlapp := CreateOleObject('Excel.Application');
except
ShowMessage('操作失敗');
Exit;
end;
xlapp.WorkBooks.Open('D:\123456.xls');
//xls 56
xlapp.Activeworkbook.saveas('D:\1.xls',56);
//xls 51
xlapp.Activeworkbook.saveas('D:\2.xlsx',51);
//csv 6
xlapp.Activeworkbook.saveas('D:\3.csv',6);
/pdf 57
xlapp.Activeworkbook.saveas('D:\4.pdf',57);
xlapp.Activeworkbook.Close(False);
xlapp.Quit;
xlapp := Null;
xlapp := Unassigned;