以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  报表标签打印怎么能打印时方向自动为纵向  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=175106)

--  作者:饭浇盖
--  发布时间:2022/2/20 14:10:00
--  报表标签打印怎么能打印时方向自动为纵向
打印机是得力的-888D

报表代码是

Dim doc As New PrintDoc \'定义一个报表
Dim w As Integer=40
Dim h As Integer=30

doc.PageSetting.Width = w \'纸张宽度为100毫米
doc.PageSetting.Height = h

Dim rt As New prt.RenderTable() \'定义一个表格对象
rt.Style.GridLines.All = New prt.LineDef \'将网格线类型设为默认类型
rt.Width = w-4 \'表格宽度为50mm
rt.height=h-4
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中
Doc.PageSetting.LeftMargin = 2 \'设置左边距
Doc.PageSetting.RightMargin = 1 \'设置右边距
Doc.PageSetting.TopMargin = 2 \'设置上边距
Doc.PageSetting.BottomMargin = 1 \'设置下边距
\'rt.Style.Spacing.Bottom = 1 \'设置下间隔为3毫米

rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'避免垂直换页的时候,表格被分割成两部分.
rt.Cols(0).Width = 10
rt.cells(0,0).Text = "编码"
rt.Cells(0,1).Text = CurrentTable.Current("商品编码")
rt.Cells(1,0).Text = "品名"
rt.Cells(1,1).Text = CurrentTable.Current("商品名称") & CurrentTable.Current("标记")


rt.cells(2,0).text=CurrentTable.Current("编码")
rt.cells(2,0).SpanCols=2

Doc.Body.Children.Add(rt) \'将表格对象加入到报表中
Doc.Preview() \'预览报表


图片点击可在新窗口打开查看

--  作者:饭浇盖
--  发布时间:2022/2/20 14:11:00
--  
每次打印都默认是横向  
--  作者:有点蓝
--  发布时间:2022/2/20 21:40:00
--  
不要设置这个,保持横向,设置好打印的高度和宽度,需要和打印纸张一致,高度和宽度不能超过打印机的可打印范围:

doc.PageSetting.Width = w \'纸张宽度
doc.PageSetting.Height = h \'纸张高度

然后把自定义纸张设置为默认纸张:http://www.foxtable.com/webhelp/topics/2904.htm

--  作者:饭浇盖
--  发布时间:2022/2/21 22:18:00
--  
好的