数据导出到Execel中,总是第一列为空不知道为何?
代码:
nCurrRow := 1;
if SePTitle <> '' then begin
Sheet.Cells[1,1] := SePTitle;
sheet.range[sheet.cells[2, 1],sheet.cells[2,nCols]].Select; //选择该列
//Excelid.selection.HorizontalAlignment := $FFFFEFF4; //居中
Excelid.selection.MergeCells := True;
//表体(包括表头)
nCurrRow := 2;
end;
ProgressBar1.Position :=0;
ProgressBar1.Max :=mGrid.RowCount;
for i:=0 to mGrid.RowCount-1 do begin
ProgressBar1.Position :=ProgressBar1.Position +1;
nCurrCol := 1;
for j:=0 to mGrid.ColCount-1 do begin
if mGrid.ColWidths[j]>0 then begin
if (j=2)or (j=4) or( j=5) then begin
Sheet.Cells[nCurrRow,nCurrCol].NumberFormatLocal := '@';
Sheet.Cells[nCurrRow,nCurrCol] := mGrid.Cells[j,i];
end else begin
Sheet.Cells[nCurrRow,nCurrCol] := mGrid.Cells[j,i];
end;
nCurrCol := nCurrCol + 1;
end;
end;
nCurrRow := nCurrRow + 1;
end;
请大家多多指教。
代码:
nCurrRow := 1;
if SePTitle <> '' then begin
Sheet.Cells[1,1] := SePTitle;
sheet.range[sheet.cells[2, 1],sheet.cells[2,nCols]].Select; //选择该列
//Excelid.selection.HorizontalAlignment := $FFFFEFF4; //居中
Excelid.selection.MergeCells := True;
//表体(包括表头)
nCurrRow := 2;
end;
ProgressBar1.Position :=0;
ProgressBar1.Max :=mGrid.RowCount;
for i:=0 to mGrid.RowCount-1 do begin
ProgressBar1.Position :=ProgressBar1.Position +1;
nCurrCol := 1;
for j:=0 to mGrid.ColCount-1 do begin
if mGrid.ColWidths[j]>0 then begin
if (j=2)or (j=4) or( j=5) then begin
Sheet.Cells[nCurrRow,nCurrCol].NumberFormatLocal := '@';
Sheet.Cells[nCurrRow,nCurrCol] := mGrid.Cells[j,i];
end else begin
Sheet.Cells[nCurrRow,nCurrCol] := mGrid.Cells[j,i];
end;
nCurrCol := nCurrCol + 1;
end;
end;
nCurrRow := nCurrRow + 1;
end;
请大家多多指教。
解决方案 »
- rave 制作主从报表
- delphi 如何分割用全角字符分隔(中文的顿号)的字符串
- 求助:我们需要得到文件路径时,可以单击一个浏览安钮,然后可以一级一级,找到这个文件,得到这个文件的路径,这是怎么做的啊?谢谢!
- 如何在 TRichEdit中 用TFontDialog 改变字体 , 我的程序老错 急!!!!!
- 大家来分享一下DELPHI的经验
- 在线等!!!关于路由问题 ????给我所有的分
- 怎样实现类似ie的地址栏的自动完成和自动加.com,.net功能?----内详!
- 如何快速截取桌面图片后分析图片的RGB值
- 弱弱一问: 在sdk下为什么我向内存dc里画线,再拷贝进设备dc,没有起作用?
- 用delphi如何能实现微机串口的数据操作
- 如何用专线网络把上级单位传过来的数据导入sql server数据库?
- jpeg error #53 这是什么意思啊 谢谢了
http://blog.csdn.net/suiyunonghen/archive/2009/05/21/4207564.aspx