小piao设计中,怎么设置纸张宽度和高度呢?主要是打印预览的时候,不是我预设的宽度,求解 另外:如何控制小piao纸刚好等于 找还 下的一行 而不打印多余的空白行!
预览时候显示如下:
此主题相关图片如下:qq图片20140727135304.jpg
![dvubb 图片点击可在新窗口打开查看](UploadFile/2014-7/201472713544520826.jpg)
在预览中选择宽度后如下:(同时希望将地址 电话等放在 合计 已优惠 找还 下面 求解)
此主题相关图片如下:qq图片20140727135239.jpg
![dvubb 图片点击可在新窗口打开查看](UploadFile/2014-7/201472713551984926.jpg)
代码如下:
Dim doc As New Printdoc
Dim rx As prt.RenderText
Dim rt As prt.RenderTable
Dim rx1 As prt.RenderText
Dim rx2 As prt.RenderText
Dim rx3 As prt.RenderText
Doc.Style.Padding.right = 1
Doc.Style.Padding.Left = 1
rx = New prt.RenderText
rx.Style.FontSize = 16
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 5
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rx.Text = "袁记串串香 瓮安店"
doc.Body.Children.Add(rx)
rx = New prt.RenderText
rx.Style.FontSize = 10
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 5
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rx.Text = "用一次性锅底 打造成都味道"
doc.Body.Children.Add(rx)
rx1 = New prt.RenderText
rx1.Style.FontSize = 10
rx1.Style.FontBold = False
rx1.Style.Spacing.Bottom = 5
rx1.Text = "打印时间: " & Date.now() & Chr(13) & Chr(10) & "桌号:" & Tables("消费明细").Current("餐桌编号") & " 单号: " & Tables("消费明细").Current("订单编号")
doc.Body.Children.Add(rx1)
rt = New prt.RenderTable
rt.Style.Padding.right = 1
rt.Style.Padding.Left = 1
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Style.TextAlignVert = prt.AlignVertEnum.Center
rt.Style.Borders.Bottom = New prt.LineDef(0.3,Color.LightGray)
rt.CellStyle.Spacing.All = 0.2
rt.Cols.Count = 5
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.rows(0).Style.Borders.Top = New prt.LineDef(1,Color.LightGray)
rt.rows(0).Style.Borders.Bottom = New prt.LineDef(1,Color.LightGray)
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)("累计消费")
Next
End With
doc.Body.Children.Add(rt)
rx = New prt.RenderText
rx.Style.FontBold = False
rx.Style.FontSize = 10
rx.Style.Spacing.Top = 3
rx.Text = "合 计:" & Tables("结账登记").Current("消费金额") & "元;" & "已优惠:" & Tables("结账登记").Current("应付金额") & "元" & Chr(13) & Chr(10) & "收 现:" & Tables("结账登记").Current("支付现金") & "元;" & "找 还:" & Tables("结账登记").Current("找零现金") & "元" & Chr(13) & Chr(10)& Chr(13)
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Left
rx2 = New prt.RenderText
rx2.Style.FontBold = False
rx2.Style.FontSize = 11
rx2.Style.Spacing.Top = 3
rx2.Text ="地 址:瓮安县农贸市场入口" & Chr(13) & Chr(10) & "加盟热线:028-77888878" & Chr(13) & Chr(10) & "订座热线:0854-77888878"
doc.Body.Children.Add(rx2)
doc.Body.Children.Add(rx)
doc.PageSetting.Width = 57 '纸张宽度为100毫米
doc.Preview