这是我用的代码。但是打印出来的不是筛选过的内容,要怎么改?
e.Form.Page.LeftMargin = 10
e.Form.Page.RightMargin = 10
e.Form.Page.TopMargin = 10
e.Form.Page.BottomMargin = 10
e.Form.Page.PaperKind = 11
e.Form.Page.Landscape = True
Dim doc As PrintDoc = e.Form.GernatePrintDoc()
Dim rw As prt.RenderText
Dim rx As prt.RenderText
Dim ry As prt.rendertext
Dim rz As prt.rendertext
Dim rt As prt.RenderTable
rw =New prt.rendertext
rw.Style.fontsize =18
rw.style.fontbold =True
rw.style.spacing.bottom=1
rw.text="采购查询表"
doc.body.children.add(rw)
rx = New prt.RenderText
rx.Style.FontSize = 11
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 1
rx.Text ="查询时间从" & forms("采购查询表").Controls("DateTimePicker1").value & "到" & forms("采购查询表").Controls("DateTimePicker2").value
doc.Body.Children.Add(rx)
'rx = New prt.RenderText
'rx.Style.FontSize = 11
'rx.Style.FontBold = True
'rx.Style.Spacing.Bottom = 1
'rx.Text ="运输方式: " & Tables("订单出库单").Current("运输方式") & " " & "安装方式: " & Tables("订单出库单").Current("安装方式") & " " & "安装员工: " & Tables("订单出库单").Current("安装员工")
'doc.Body.Children.Add(rx)
rt = New prt.RenderTable
rt.Rows.Count = 11
rt.Cols.Count = 9
rt.Cols(0).Width = 12
rt.Height = 66
rt.CellStyle.Spacing.All = 1
rt.Style.GridLines.All = New prt.Linedef
rt.Cells(0,0).Text = "编号"
rt.Cells(0,1).Text = "采购数量"
rt.Cells(0,2).Text = "单价"
rt.Cells(0,3).Text = "备注"
rt.Cells(0,4).Text = "入库标识"
rt.Cells(0,5).Text = "付款标识"
rt.Cells(0,6).Text = "物料名称"
rt.Cells(0,7).Text = "物料型号"
rt.Cells(0,8).Text = "单位"
With Tables("采购单.采购单明细表")
For r As Integer = 0 To .Rows.Count - 1
rt.Cells(r+1,0).Text = .rows(r)("明细编号")
rt.Cells(r+1,1).Text = .rows(r)("采购数量")
rt.Cells(r+1,2).Text = .rows(r)("单价")
rt.Cells(r+1,3).Text = .rows(r)("备注")
rt.Cells(r+1,4).Text = .rows(r)("入库标识")
rt.Cells(r+1,5).Text = .rows(r)("付款标识")
rt.Cells(r+1,6).Text = .rows(r)("物料名称")
rt.Cells(r+1,7).Text = .rows(r)("物料型号")
rt.Cells(r+1,8).Text = .rows(r)("单位")
Next
End With
doc.Body.Children.Add(rt)
rx = New prt.RenderText
rx.Style.FontBold = True
rx.Style.Spacing.Top = 3
rx.Text = "采购种类: " & Tables("采购单.采购单明细表").Rows.Count
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right
doc.Body.Children.Add(rx)
ry = New prt.RenderText
ry.Style.FontBold = True
ry.Style.Spacing.Top = 3
ry.Text ="录单日期: " & Tables("订单出库单").Current("录单日期")& " " & "经手人: " & Tables("订单出库单").Current("经手人")
doc.Body.Children.Add(ry)
doc.Preview