各位大虾:
你们好,我现在很急,公司有很多excel文件里面有很多数据,我想通过
前端delphi程序来读取,然后保存到数据库后台,不知道有什么办法?请各位大师
救救我!
你们好,我现在很急,公司有很多excel文件里面有很多数据,我想通过
前端delphi程序来读取,然后保存到数据库后台,不知道有什么办法?请各位大师
救救我!
解决方案 »
- 用vclskin控件后,双击窗体标题栏锁定了,高手进,在线急等之
- dbgrid的行如何编号
- 如何在不输入查询条件的情况下自动遍历access数据库表,查找是否有某个特定字段值相同的记录???
- 很简单的问题,请各位大虾帮个忙。
- Listview下如何刷新数据
- 我在做一个采集直流电参数仪的测量器的程序,是用rs232c口的,我用spcomm...
- ■■让程序在电脑硬盘里随机找出几个文本文件,有没有什么好的方法?
- 再次提问!!!如何得知当前Windows支持双字节否?
- 有没有豆瓣发豆油的例子??
- Tbookmark是否可以存到Field中(如何保存某一Bookmark?)
- 一个简单的有关表的更新问题
- 用NMSMTP做MAIL时,怎样根据邮箱名得到它的SMTP服务器名称啊?欢迎光临!!
在Google里搜索《葵花宝典》,是delphi的帮助工具。很好用的。同时,也给你一个小例子吧。 var
bm: TBook;
col, row: Integer;
sline: String;
mem: TMemo;
ExcelApp: Variant;
begin
Screen.Cursor := crHourglass;
DBGrid1.DataSource.DataSet.DisableControls;
bm := DBGrid1.DataSource.DataSet.GetBook;
DBGrid1.DataSource.DataSet.First;
// create the Excel object
if toExcel then
begin
ExcelApp := CreateOleObject('Excel.Application');
ExcelApp.WorkBooks.Add(xlWBatWorkSheet);
ExcelApp.WorkBooks[1].WorkSheets[1].Name := 'Grid Data';
end;
// First we send the data to a memo
// works faster than doing it directly to Excel
mem := TMemo.Create(Self);
mem.Visible := false;
mem.Parent := MainForm;
mem.Clear;
sline := '';
// add the info for the column names
for col := 0 to DBGrid1.FieldCount-1 do
sline := sline + DBGrid1.Fields[col].DisplayLabel + #9;
mem.Lines.Add(sline);
// get the data into the memo
for row := 0 to DBGrid1.DataSource.DataSet.RecordCount-1 do
begin
sline := '';
for col := 0 to DBGrid1.FieldCount-1 do
sline := sline + DBGrid1.Fields[col].AsString + #9;
mem.Lines.Add(sline);
DBGrid1.DataSource.DataSet.Next;
end;
// we copy the data to the clipboard
mem.SelectAll;
mem.CopyToClipboard;
// if needed, send it to Excel
// if not, we already have it in the clipboard
if toExcel then
begin
ExcelApp.Workbooks[1].WorkSheets['Grid Data'].Paste;
ExcelApp.Visible := true;
end;
不知道还笑别人,去搜吧,肯定对你有帮助的!!
我是通過delphi程序來讀取excel文件中的數據呀,而不是通過delphi把數據導出到
excel中去。至於《葵花宝典》我去查查