高手指点下,该如何做?(50分)

  • 主题发起人 主题发起人 yukuaiz
  • 开始时间 开始时间
Y

yukuaiz

Unregistered / Unconfirmed
GUEST, unregistred user!
or &nbsp; k:=0 &nbsp; to &nbsp; listview4.Items.Count-1 &nbsp;do<br><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;worksheet.cells[1,k+1]:=listview4.Items[k].Caption<br>为什么我listview的第一列数据导入到Excel中却以行的形式显示,应该是listview第一列的数据放入Excel的第一列啊,谁能告诉我啊?
 
先帮你顶一下,没研究过
 
Cells的第一个参数是行,第二个是列。楼主的代码中,行号不变,而列号变化,自然都<br>位于一行里面了...
 
worksheet.cells[k,k+1]:=listview4.Items[k].Caption
 
想实现你的功能,改一下行和列就可以了,
 
唉,对于这个问题,看来还是我自己回答我自己算了,其实很简单,是这样的<br>&nbsp; &nbsp; &nbsp; &nbsp;for &nbsp; i:=0 &nbsp; to &nbsp; listview8.items.count-1 &nbsp; do<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; k:=0;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for j:=0 to listview8.Columns.Count-1 do<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if j=0 then<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;worksheet.cells[1,1]:='单位编号';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;worksheet.cells[1,2]:='个人编号';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;worksheet.cells[1,3]:='身份证编号';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;worksheet.cells[1,4]:='姓名';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;worksheet.cells[1,5]:='性别';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;worksheet.cells[1,6]:='参工日期';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;worksheet.cells[1,7]:='人员状态';<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;worksheet.cells[i+2,j+1]:=''''+Listview8.items.caption;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; worksheet.cells[i+2,j+1]:=''''+Listview8.items.SubItems[k];<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; k:=k+1;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;end;
 
后退
顶部