CxGrid 導出 Excel
uses cxGridExportLink;
ExportGridToExcel('c: emp.xls',self.cxgrd1);
RichEdit讀取Xls文件,保留表格樣式
uses Clipbrd,ComObj;
procedure TForm3.btn1Click(Sender: TObject);
var
xls:variant;
begin
uredt1.Clear;
Clipboard.Clear;
xls:=createoleobject( 'Excel.Application');
try
xls.displayalerts := false; //取掉提示框
xls.workbooks.open( 'c: emp.xls ',false);
try
xls.worksheets[1].range[ 'a:e '].copy;//你要選擇的列
uredt1.pastefromclipboard;
finally
xls.WorkBooks.Close;
xls.quit;
end;
Clipboard.Clear;
except
showmessage('沒安裝 Excel!');
end;
end;
uses cxGridExportLink;
ExportGridToExcel('c: emp.xls',self.cxgrd1);
RichEdit讀取Xls文件,保留表格樣式
uses Clipbrd,ComObj;
procedure TForm3.btn1Click(Sender: TObject);
var
xls:variant;
begin
uredt1.Clear;
Clipboard.Clear;
xls:=createoleobject( 'Excel.Application');
try
xls.displayalerts := false; //取掉提示框
xls.workbooks.open( 'c: emp.xls ',false);
try
xls.worksheets[1].range[ 'a:e '].copy;//你要選擇的列
uredt1.pastefromclipboard;
finally
xls.WorkBooks.Close;
xls.quit;
end;
Clipboard.Clear;
except
showmessage('沒安裝 Excel!');
end;
end;