以前只有在fox和foxpro用到过打印机,语句和你的类似,你的问题估计是vpf没有设置行列间距。
VB的我没用过,简单的打印调用printer可以。
给你贴一个别人的:
Printer.FontSize = 19.2
DataTitle = "XXXXXXXX"
Pageheader = 25
Pagefooter = 25
Pageleft = 20
Pageright = 20
With Printer
.PaperSize = vbPRPSA4
' 设置为A4纸
.ScaleMode = vbMillimeters
.FontBold = True
.ScaleLeft = -20
.ScaleTop = -25
.ScaleWidth = 210
.ScaleHeight = 297
UseWidth = .ScaleWidth - Pageleft - Pageright
UseHeight = .ScaleHeight - Pageheader - Pagefooter
.CurrentX = 0
.CurrentY = 0
.DrawWidth = 5
End With
'打印标题
With Printer
.FontSize = 20
.CurrentX = (UseWidth - .TextWidth(DataTitle)) / 2
.CurrentY = Pageheader + .ScaleTop
End With
Printer.Print DataTitle
Printer.FontSize = 10
Printer.CurrentX = Pageleft + Printer.ScaleLeft
startyline = Printer.CurrentY
DataRow = ""
With Printer
'打印字段名
.CurrentY = .CurrentY + 15
Y = .CurrentY
For N = 0 To RS.Fields.Count - 2
.CurrentX = (UseWidth / RS.Fields.Count) * N + Pageleft
.CurrentY = Y
SectionPos(N) = .CurrentX
Printer.Print IIf(IsNull(RS.Fields(N + 1).Name), "", RS.Fields(N + 1).Name)
Next
.CurrentX = SectionPos(0)
Printer.Print DataRow
'打印每行数据
Do While .CurrentY <= .ScaleHeight - Pagefooter
DataRow = ""
Y = .CurrentY
For N = 0 To RS.Fields.Count - 2
.CurrentX = SectionPos(N)
.CurrentY = Y
Printer.Print IIf(IsNull(RS.Fields(N + 1).Value), "", RS.Fields(N + 1).Value)
Next
RS.MoveNext
If RS.EOF <> True Then
Else
Exit Do
End If
Loop
.EndDoc
End With