Dim Printrow() As String
Dim printcol(0 To 8) As String
Dim flexarry As String
Dim lines As String
Dim counts As String
Dim bottom_margin As Single
Const Top_MARGIN = 1440
Const LEFT_MARGIN = 1440
lines = "————————————————————————————————————————————————————————————"
FontItalic = False
Font = "宋体"
FontSize = 14
' Print
' Print
' Print
bottom_margin = printer.ScaleTop + printer.ScaleHeight - 1440
For i = 1 To 8
printcol(i) = MSHFlexGrid1.TextArray(i)
If i = 0 Then Printer.print Tab(5);
If i = 1 Then Printer.print Tab(10);
If i = 2 Then Printer.print Tab(18);
If i = 3 Then Printer.print Tab(26);
If i = 4 Then Printer.print Tab(34);
If i = 5 Then Printer.print Tab(44);
If i = 6 Then Printer.print Tab(54);
If i = 7 Then Printer.print Tab(65);
If i = 8 Then Printer.print Tab(73);
Print printcol(i);
Next i
Printer.print
Printer.print lines
' Printer.CurrentY = Top_MARGIN
counts = MSHFlexGrid1.Rows
ReDim Printrow(counts)
For j = 1 To counts - 1
For k = 0 To 8
Printrow(j - 1) = MSHFlexGrid1.TextMatrix(j, k)
If k = 0 Then Print Tab(5);
If k = 1 Then Print Tab(10);
If k = 2 Then Print Tab(18);
If k = 3 Then Print Tab(26);
If k = 4 Then Print Tab(34);
If k = 5 Then Print Tab(44);
If k = 6 Then Print Tab(54);
If k = 7 Then Print Tab(65);
If k = 8 Then Print Tab(73);
Print Printrow(j - 1);
Next k
Printer.print
Printer.print lines
If CurrentY >= bottom_margin Then
'start a new pge
' For q = 1 To 8 '我想在第二页中也有表的字段可是它总是打在第一页的末尾,这是什么原因。
' printcol(q) = MSHFlexGrid1.TextArray(q)
' If q = 0 Then Printer.Print Tab(5);
' If q = 1 Then Printer.Print Tab(10);
' If q = 2 Then Printer.Print Tab(18);
' If q = 3 Then Printer.Print Tab(26);
' If q = 4 Then Printer.Print Tab(34);
' If q = 5 Then Printer.Print Tab(44);
' If q = 6 Then Printer.Print Tab(54);
' If i = 7 Then Printer.Print Tab(65);
' If i = 8 Then Printer.Print Tab(73);
' Printer.Print printcol(q);
' Next q
' Printer.Print
Printer.print NewPage
' Printer.CurrentY = Top_MARGIN
' Printer.Print
' Printer.Print lines
' End If
Next j
' Printer.EndDoc
我改呀改的最后改得效果越来越不好不是重页就是间距自动大了我都不知道哪的原因。请大家帮帮忙在此谢谢了。
还有我定义了lines as string
lines="_______"
目的是在每一行的末尾,打一回车后再一横线。可是有时能打印.有时打不出来.因为我总是改这几条语句。Printer.CurrentY = Top_MARGIN我不知道把它放在哪个语句的位置合适。
If CurrentY >= bottom_margin Then
Printer.print NewPage
Printer.CurrentY = Top_MARGIN
endif
Dim printcol(0 To 8) As String
Dim flexarry As String
Dim lines As String
Dim counts As String
Dim bottom_margin As Single
Const Top_MARGIN = 1440
Const LEFT_MARGIN = 1440
lines = "————————————————————————————————————————————————————————————"
FontItalic = False
Font = "宋体"
FontSize = 14
bottom_margin = printer.ScaleTop + printer.ScaleHeight - 1440
For i = 1 To 8
printcol(i) = MSHFlexGrid1.TextArray(i)
If i = 0 Then Printer.print Tab(5);
If i = 1 Then Printer.print Tab(10);
If i = 2 Then Printer.print Tab(18);
If i = 3 Then Printer.print Tab(26);
If i = 4 Then Printer.print Tab(34);
If i = 5 Then Printer.print Tab(44);
If i = 6 Then Printer.print Tab(54);
If i = 7 Then Printer.print Tab(65);
If i = 8 Then Printer.print Tab(73);
Print printcol(i);
Next i
Printer.print
Printer.print lines
' Printer.CurrentY = Top_MARGIN
counts = MSHFlexGrid1.Rows
ReDim Printrow(counts)
For j = 1 To counts - 1
For k = 0 To 8
Printrow(j - 1) = MSHFlexGrid1.TextMatrix(j, k)
If k = 0 Then Print Tab(5);
If k = 1 Then Print Tab(10);
If k = 2 Then Print Tab(18);
If k = 3 Then Print Tab(26);
If k = 4 Then Print Tab(34);
If k = 5 Then Print Tab(44);
If k = 6 Then Print Tab(54);
If k = 7 Then Print Tab(65);
If k = 8 Then Print Tab(73);
Print Printrow(j - 1);
Next k
Printer.print
Printer.print lines
If CurrentY >= bottom_margin Then
'start a new pge
' For q = 1 To 8 '我想在第二页中也有表的字段可是它总是打在第一页的末尾,这是什么原因。
' printcol(q) = MSHFlexGrid1.TextArray(q)
' If q = 0 Then Printer.Print Tab(5);
' If q = 1 Then Printer.Print Tab(10);
' If q = 2 Then Printer.Print Tab(18);
' If q = 3 Then Printer.Print Tab(26);
' If q = 4 Then Printer.Print Tab(34);
' If q = 5 Then Printer.Print Tab(44);
' If q = 6 Then Printer.Print Tab(54);
' If i = 7 Then Printer.Print Tab(65);
' If i = 8 Then Printer.Print Tab(73);
' Printer.Print printcol(q);
' Next q
' Printer.Print
Printer.print NewPage
' Printer.CurrentY = Top_MARGIN
' Printer.Print
' Printer.Print lines
' End If
Next j
' Printer.EndDoc
我改呀改的最后改得效果越来越不好不是重页就是间距自动大了我都不知道哪的原因。请大家帮帮忙在此谢谢了。
还有我定义了lines as string
lines="_______"
目的是在每一行的末尾,打一回车后再一横线。可是有时能打印.有时打不出来.因为我总是改这几条语句。Printer.CurrentY = Top_MARGIN我不知道把它放在哪个语句的位置合适。
If CurrentY >= bottom_margin Then
Printer.print NewPage
Printer.CurrentY = Top_MARGIN
endif
Printer.print NewPage
Printer.CurrentY = Top_MARGIN
endif不能让CurrentY = bottom_margin 它时才换行,这样会有数据无法打印出来
一般当CurrentY + 一段距离 就开始换行,这个是多少自己定,我一般控制在5厘米错几行的方法可以控制CurrentY来实现
If Printer.CurrentY = Printer.CurrentY + 100 Then
'start a new pge
' Printer.CurrentY = CurrentY + 5
Printer.Print CurrentY
Printer.Print Newpage
CurrentY = Top_MARGIN + 1880
End If
End If
我这样写还是不对。因为效果还是出不来。你可否告诉我错几行用currentY来控制的语句呢!谢谢你。5厘米用语句来说是多大呀。我实在是不懂。