利用VB设计打印复杂报表[2]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 cnviolet 的 blog

datprimaryrs.recordset.movefirst

‘datprimaryrsdata控件

if isnull(datprimaryrs.recordset!姓名) = false then

xlsheet.cells(4, 2) = datprimaryrs.recordset!姓名

end if

if isnull(datprimaryrs.recordset!性别) = false then

xlsheet.cells(4, 4) = datprimaryrs.recordset!性别

end if

if isnull(datprimaryrs.recordset!民族) = false then

xlsheet.cells(4, 6) = datprimaryrs.recordset!民族

end if

………………

      . 打印报表

   生成了工作表后,就可以对excel发出打印指令了。

    注意在执行打印操作之前应该对excel临时文件执行一次保存操作,以免在退出应用程序后excel还提示用户是否保存已修改的文件,让用户觉得莫名其妙。如下语句:

xlbook.save ‘保存文件

xlsheet.printout ‘执行打印

xlapp.quit ‘退出excel

本文关键:VB,打印,报表
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top