打印的代码基本形同只是每个打印机的调的边距不同
Private Sub Cmdprint_Click()
'打印
'""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
On Error GoTo errhandler
'Dim aa As Integer
'aa = Len(Text1(21).Text)
With cdlPicture
.Flags = cdlCFBoth Or cdlCFWYSIWYG Or cdlCFScalableOnly Or cdlCFEffects
.CancelError = True
.ShowFont
End With
Dim beginfpage, endpage, numcopies, orientation, i
cdlPicture.CancelError = True
On Error GoTo errhandler
'隐藏打印到文件和份数
cdlPicture.Flags = &H100000 Or cdlPDUseDevModeCopies
cdlPicture.orientation = cdlPortrait '默认为纵向打印
cdlPicture.ShowPrinter
Printer.orientation = cdlPicture.orientation
' '下面语句设置打印的参数
Printer.FontName = cdlPicture.FontName
Printer.FontBold = cdlPicture.FontBold
Printer.FontItalic = cdlPicture.FontItalic
Printer.FontSize = cdlPicture.FontSize
Printer.FontUnderline = cdlPicture.FontUnderline
Printer.FontStrikethru = cdlPicture.FontStrikethru
'设置打印内容
'""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
datPrimaryRS.Recordset.MoveFirst
Dim hab As Integer
Printer.Print Frmmain.Text1(0) &" 还款记录"
Printer.Print
Printer.Print Spc(13)"日期:" &DateSpc(3)"时间:" &Time
Printer.Print "---------------------------------------------"
Printer.Print "还款日期"TabTab"还款额(元)"
Printer.Print "---------------------------------------------"
For hab = 1 To datPrimaryRS.Recordset.RecordCount
If datPrimaryRS.Recordset.EOF Or datPrimaryRS.Recordset.BOF Then
Exit Sub
End If
Printer.Print Text1, TabText2
datPrimaryRS.Recordset.MoveNext
Next hab
frmfm.Print "---------------------------------------------"
Printer.EndDoc
Exit Sub
errhandler:
Printer.EndDoc '清空打印机
Exit Sub
End Sub
这是我用ACTIVEREPORT 报表控件的代码 设计器的NAME bb_rkckd 楼上的兄台,我不知道你用什么做表表,但是我提议你使用水晶报表或ACTIVEREPORT
With bb_rkckd
.dmmc = logouserbm
.dwmc = title_dlx
.Label2 = " " &Label4.Caption &" "
.Caption = Label4.Caption
.DataControl1.ConnectionString = conn
.DataControl1.Source = strsql
.DataControl1.Refresh
.lab_tjrq.Caption = "报表日期:" &Format(DTPicker1(0), "YYYY年MM月DD日") &"至" &Format(DTPicker1(1), "YYYY年MM月DD日")
.FID_RQ.DataField = "日期"
.FID_DH.DataField = "单号"
.FID_CK.DataField = "库房"
.FID_DW.DataField = "供应商"
.FID_JSFS.DataField = "结算方式"
.FID_JE.DataField = "金额(元)"
.JEHJ.DataField = "金额(元)"
.pagehj.DataField = "金额(元)"
.Show
End With
Command1(1).Enabled = False
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)