FasReport 输出文件时,转换成Excel时,不能一列对一列的导出成Excel 的列数
而是用什么分隔符来区分,在同一列中
能不能导出成分开的列
如:(FasReport)
sID sName
11 aaaa
12 bbbb转成:(Excel) 不是这样:(Excel)
A B A
11 aaaa 11;aaaa
12 bbbb 12;bbbb
而是用什么分隔符来区分,在同一列中
能不能导出成分开的列
如:(FasReport)
sID sName
11 aaaa
12 bbbb转成:(Excel) 不是这样:(Excel)
A B A
11 aaaa 11;aaaa
12 bbbb 12;bbbb
http://www.csdn.net/Subject/137/index.shtm
http://www.csdn.net/Subject/137/index.shtm
只是中间变成了几个空格,该怎么做才能解决
难道你们重来没有导入导出过吗?
var
szbuffer : string;
zi, lField : integer;
fprogress : Tfprogress;
strlist : TStringList;
begin
Result := false;
if DataGirld.RowCount <= 0 then exit;
if strFileName = EmptyStr then
begin
strFileName := ExtractFileDir(Application.ExeName) + '\GraspExecel.xls'
end;
application.CreateForm(tfprogress, fprogress);
try
fprogress.show;
fprogress.Update;
fprogress.ProgressBar1.Position := 10;
fprogress.ProgressBar1.Max := DataGirld.RowCount;
fprogress.ProgressBar1.Position := fprogress.ProgressBar1.Position + 20;
strlist := TStringList.Create;
for zi := 0 to DataGirld.colCount-1 do //取表头字段名称
begin
if szbuffer = EmptyStr then
begin
szbuffer :=' '+trim(DataGirld.Cells[zi, 0]);
end
else
szbuffer := szbuffer + char(vk_Tab) +Trim(DataGirld.Cells[zi, 0]);
end;
fprogress.ProgressBar1.Position := fprogress.ProgressBar1.Position + 10;
strlist.Add(szbuffer);
szbuffer := EmptyStr;
for zi :=1 to DataGirld.RowCount do //取表体内容
begin
for lField :=0 to DataGirld.ColCount do //chanage 1 to 2
begin
szbuffer := szbuffer + DataGirld.Cells[ lfield,zi]+ chAr(VK_TAB) ;
end;
strlist.Add(szbuffer);
szbuffer := EmptyStr;
fprogress.ProgressBar1.Position := fprogress.ProgressBar1.Position + 2;
end;
strlist.SaveToFile(strFileName);
fprogress.ProgressBar1.Position := fprogress.ProgressBar1.max;
if lTypeid = 1 then
ShellExecute(application.Handle, 'open', pchar(strFileName), nil, nil, SW_SHOWNORMAL);
finally
strlist.Free;
fprogress.close;
fprogress.Free;
end;
Result := true;
end;
可以去修改那个控件,使其加一个Tab 分隔符的功能