如何打印datagrid中的数据 如何打印datagrid中的数据 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用DataReport作报表 http://www.microsoft.com/china/msdn/vbasic/technical/tutorial/tour/data.htmhttp://www.microsoft.com/china/msdn/technic/develop/vb/0125h.asphttp://www.yesky.com/20020108/213121.shtml 打印与datagrid帮定的数据集就行了. 如何打印与datagrid帮定的数据集呢 把DATAGRID中的数据放入EXCEL中,然后打印即可. 通过生成MICROSOFTWORD表格打印 1、在declaration中写入:DimmswordAsObject 2、加入打印命令按 钮(command2),CAPTION设为"生成WORD表格",写入下面代码,PrivateSub command2_Click()screen.MousePointer=11Setmsword=CreateObject("word.basic")DimAppID,ReturnValueappID=Shell("d:\office97\office\WINWORD.EXE",1)RunMicrosoftWord.msword.AppActivate"MicrosoftWord"msword.AppActivate"MicrosoftWord",1fullScreen.MousePointer=0EndSub 2、写入以下过程full()Subfull()DimiAsInteger,jAsInteger,colAsInteger,rowAsIntegerDimcellcontentAsStringMe.Hidecols=4表格的列数row=gridrow打印表的行数msword.filenewdefaultmsword.MsgBox"正在建立MS_WORD报表,请稍候.......","",-1msword.leftparamsword.screenupdating0msword.tableinserttable,col,row,,,16,167msword.startofdocumentforj=0togridrow表格的行数grid1.row=jFori=1TocolsGri1d.col=iIfIsNull(grid1.text)Thencellcontent$=""Elsecellcontent$=grid1.textEndIfmsword.Insertcellcontent$msword.nextcellNextiNextjmsword.tabledeleterowmsword.startofdocumentmsword.tableselectrowmsword.tableheadings1msword.centerparamsword.startdocumentmsword.screenrefreshmsword.screenupdating1msword.MsgBox"结束","",-1Me.ShowEndSub 通过发送到MICROSOFTEXCEL实现表格打印 1、加入打印命令按钮(command3),CAPTION设为"生成EXCEL表格",写入下面代 码PrivateSubcommand3_Click()DimiAsIntegerDimjAsIntegerDimxlAppAsExcel.ApplicationDimxlBookAsExcel.WorkbookDimxlSheetAsExcel.WorksheetSetxlApp=CreateObject("Excel.Application")xlApp.Visible=TrueSetxlBook=xlApp.Workbooks.AddOnErrorResumeNextSetxlBook=xlApp.Workbooks.AddOpen("d:\text2.xls")SetxlSheet=xlBook.Worksheets(1)xlSheet.Cells(6,1)="i"Fori=0Togridrowgrid1.Row=iForj=0To6Grid1.Col=jIfIsNull(Grid1.Text)=FalseThenxlSheet.Cells(i+5,j+1)=Grid1.TextEndIfNextjNextiExitSub 楼上的同志,替楼主问一下,用EXCEL的方法,可以让用户修改后,能彻底的关掉xlappexcel和xlboolexcel 不打印记录集,只打印DATAGRID中的数据因为记录集和DATAGRID中的数据不一样,DATAGRID使用了FILTER进行了过滤 DataReport打印也可以调用EXCEll表,用SQL写入进行打印 怎样不打印小数点 怎样把几个工程整合为一个工程,生成一个EXE文件 我在程序里可不可以向spread的combox付值?(不是指在combox属性里) 请教两个问题。 200分问:如何快速学会vb 有何簡單方法將ADODB.RECORDSET轉換為相對應的TXT文檔(字段間用TAB相隔)? 我该将用记事本写的.ini存在何处才可以用??? 消息环的架构是什么(可不可以给我几个例子) 簡單api問題,十分鐘結貼。 关于adodc和DBGRID的实现查询的问题 请问:怎么把Picture控件设置成透明的 公式在数据库中如何保存?
http://www.microsoft.com/china/msdn/vbasic/technical/tutorial/tour/data.htm
http://www.microsoft.com/china/msdn/technic/develop/vb/0125h.asp
http://www.yesky.com/20020108/213121.shtml
1、在declaration中写入:
DimmswordAsObject
2、加入打印命令按 钮(command2),CAPTION设为"生成WORD表格",写入下面代码,
PrivateSub command2_Click()
screen.MousePointer=11Setmsword=CreateObject("word.basic")
DimAppID,ReturnValueappID=Shell("d:\office97\office\WINWORD.EXE",1)RunMicrosoftWord.
msword.AppActivate"MicrosoftWord"msword.AppActivate"MicrosoftWord",1fullScreen.MousePointer=0EndSub
2、写入以下过程full()
Subfull()DimiAsInteger,jAsInteger,colAsInteger,rowAsIntegerDimcellcontentAsStringMe.Hidecols=4表格的列数row=gridrow打印表的行数msword.filenewdefaultmsword.MsgBox"正在建立MS_WORD报表,请稍候.......","",-1msword.leftparamsword.screenupdating0msword.tableinserttable,col,row,,,16,167msword.startofdocumentforj=0togridrow表格的行数grid1.row=jFori=1TocolsGri1d.col=iIfIsNull(grid1.text)Thencellcontent$=""Elsecellcontent$=grid1.textEndIfmsword.Insertcellcontent$msword.nextcellNextiNextjmsword.tabledeleterowmsword.startofdocumentmsword.tableselectrowmsword.tableheadings1msword.centerparamsword.startdocumentmsword.screenrefreshmsword.screenupdating1msword.MsgBox"结束","",-1Me.Show
EndSub
1、加入打印命令按钮(command3),CAPTION设为"生成EXCEL表格",写入下面代 码
PrivateSubcommand3_Click()DimiAsIntegerDimjAsIntegerDimxlAppAsExcel.ApplicationDimxlBookAsExcel.WorkbookDimxlSheetAsExcel.Worksheet
SetxlApp=CreateObject("Excel.Application")xlApp.Visible=TrueSetxlBook=xlApp.Workbooks.AddOnErrorResumeNextSetxlBook=xlApp.Workbooks.AddOpen("d:\text2.xls")SetxlSheet=xlBook.Worksheets(1)xlSheet.Cells(6,1)="i"Fori=0Togridrowgrid1.Row=iForj=0To6Grid1.Col=j
IfIsNull(Grid1.Text)=FalseThenxlSheet.Cells(i+5,j+1)=Grid1.TextEndIfNextjNextiExitSub
因为记录集和DATAGRID中的数据不一样,DATAGRID使用了FILTER进行了过滤
也可以调用EXCEll表,用SQL写入进行打印