请问改如何实现
解决方案 »
- MD5算法中MD5Digest转换为String的问题
- [[简单问题,大家给个方法了!]]数据录入窗体中数据要录入的数据分别是“高”、“中”、“低”,如何在存入数据库时存为“1” 、 “2”、
- 大虾帮忙看看这个程序为什么错?
- 窗体创建的问题,f:=TForm2.create(self);f:=TForm2.create(nil);f:=TForm2.create(Application);这三种方法创建的窗体有什么不同?关闭窗
- 用fastreport如何实现这样的折行打印
- 请问一个Form类中函数调用到自定义TDerived类,不识别请问哪儿错了.
- 『简单问!』[]和set of 是作什么的
- Unit1.pas(43): Undeclared identifier: 'ShellExecute'
- 一个非常让我头疼的spcomm的问题,谁解决了我给100分!
- combobox中的内容如何显示到Edit中
- 高手请进!!
- 关于进程间数据交换问题
2、第1如果没有,就了解一下表的内容是从哪里来的,是否数据集?
3、第2如果是,那么问题就在于从数据库导入excel问题
4、从数据库导入excel,论坛里面帖子千千万,搜索一下,保证有你想要的
如果你用DBGrid把数据显示出来,不管你用什么数据库,都可以导出到Excel表里! uses ComObj; procedure TSearchinforfrm.Button11Click(Sender: TObject);
var
eclApp,WorkBook:olevariant;
xlsFileName:string;
i,j:integer;
begin if SaveDialog1.Execute then
xlsFileName:=SaveDialog1.FileName; try
eclApp:=CreateOleObject('Excel.Application');
WorkBook:=CreateOleObject('Excel.Sheet');
except
Application.MessageBox('系统没有安装Microsoft Excel','Microsoft Excel',MB_OK+MB_ICONWarning);
Exit;
end; try
WorkBook:=eclApp.workbooks.Add;
for i:=0 to DBGrid1.Columns.Count-1 do
begin
//这里可以更改列名,用if ... then进行判断和指定列名
eclApp.Cells(1,i+1):=DBGrid1.Columns[i].FieldName;
end; DBGrid1.DataSource.DataSet.First;
j:=2;
while not DBGrid1.DataSource.DataSet.Eof do
begin
for i:=0 to DBGrid1.DataSource.DataSet.FieldCount-1 do
begin
eclApp.Cells(j,i+1):=DBGrid1.DataSource.DataSet.Fields[i].Value;
end;
DBGrid1.DataSource.DataSet.Next;
inc(j);
end; WorkBook.SaveAS(xlsFileName);
WorkBook.close;
except
ShowMessage('文件导出失败!');
Exit;
end;
Application.MessageBox('保存成功!','恭喜',MB_OK + MB_ICONINFORMATION);
end;
感觉还不如弹出一个面板直接让table来直接显示
uses shallAPI;shellexecute(0, 'open', 'file_path' , nil, nil, sw_shownormal) ;