打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
delphi生成excel之csv文本的方法

delphi生成excel之csv文本的方法

proceduce BackupTableToCSV(tableName:TTable);
var
i,j: integer; (*i-field, j-record*)
s: string; (*Record string*)
theStringList: Tstringlist; (*temp storage*)

begin
s:='';
theStringList:=TStringList.Create;
with tableName do
begin
try
Active:=True;
except
showmessage('Could not activate '+ Name);
end;
for j:=0 to (RecordCount-1) do
begin
s:='';
for i:=1 to (FieldCount-1) do
begin
(*add next field w/comma delimiter*)
s:=s+(Fields[i].AsString)+','; //以","分隔,也可以用#9代替
end; (*i for*)
theStringList.add(s);
Next;
end; (*i for*)
theStringList.savetofile
(Name+'.csv'); (*memo1.lines.*)
Showmessage(Name+ ' has been backed up.');
close;
end; (*with*)
end; (*BackupTableToCSV*)

 

 

//如果要加入公式,可以这样

在某一行某一列:=sum(B2:B30)

定位列就在前面加","

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Delphi中JSon SuperObject类库使用
MySQL 去除字段中的换行和回车符
word或csv文件转换成excel的方法
【软件应用】word或csv文件转换成excel的方法
Delphi DBGrid双击事件、单元格操作
Excel经验畅谈:白费了两个小时,不看后悔!
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服