以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]窗体打印使用代码直接打印太过偏左  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=102047)

--  作者:yj1041132457
--  发布时间:2017/6/12 14:27:00
--  [求助]窗体打印使用代码直接打印太过偏左
 
左边是doc.Preview() 预览后再按打印打出来的的效果,右边是用doc.Print()打印出来的结果,全都扁到左边,有一部看不见了

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




--  作者:有点色
--  发布时间:2017/6/12 14:34:00
--  

 贴出你的预览和打印代码。

 

 你直接用代码设置一下边距呢? 

 

http://www.foxtable.com/webhelp/scr/1602.htm

 


--  作者:yj1041132457
--  发布时间:2017/6/12 14:37:00
--  
 
Dim doc As PrintDoc = e.Form.GernatePrintDoc()
Dim dyjm As String=Tables("赋值").rows(0)("装箱清单打印机")
Dim rt As prt.RenderText
rt = New prt.RenderText \'设置文本对象的内容
rt.Text = "第[PageNo]页,共[PageCount]页" \'设置文本内容
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'靠右对齐
rt.Style.Borders.Top = New prt.LineDef(0.3, Color.Green) \'设置底边框
rt.Style.Padding.Bottom = 0.5 \'底端内容缩进0.5毫米
rt.Style.FontSize = 8 \'字体大小为8磅
Doc.PageFooter = rt
e.Form.Page.Width = 148
e.Form.Page.Height = 210 \'
e.Form.Page.PaperKind =11 \'纸张类型改为A5
Doc.PrinterName = dyjm   \'设置默认打印机


If Tables("赋值").rows(0)("直接打印判断")=True Then
    doc.Print()  \'打印
Else
doc.Preview()  \'打印预览
End If

Forms("装箱清单").Close






--  作者:yj1041132457
--  发布时间:2017/6/12 14:39:00
--  
预览的效果是这样子的

图片点击可在新窗口打开查看
--  作者:有点色
--  发布时间:2017/6/12 14:41:00
--  

 这样试试


Dim doc As PrintDoc = e.Form.GernatePrintDoc()
Dim dyjm As String=Tables("赋值").rows(0)("装箱清单打印机")
Dim rt As prt.RenderText
rt = New prt.RenderText \'设置文本对象的内容
rt.Text = "第[PageNo]页,共[PageCount]页" \'设置文本内容
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'靠右对齐
rt.Style.Borders.Top = New prt.LineDef(0.3, Color.Green) \'设置底边框
rt.Style.Padding.Bottom = 0.5 \'底端内容缩进0.5毫米
rt.Style.FontSize = 8 \'字体大小为8磅
Doc.PageFooter = rt
\'e.Form.Page.PaperKind =11 \'纸张类型改为A5
Doc.PrinterName = dyjm   \'设置默认打印机
doc.AutoRotate = False

If Tables("赋值").rows(0)("直接打印判断")=True Then
    doc.Print()  \'打印
Else
    doc.Preview()  \'打印预览
End If

[此贴子已经被作者于2017/6/12 14:49:35编辑过]

--  作者:yj1041132457
--  发布时间:2017/6/12 14:50:00
--  
 不行额,还是原来那样

--  作者:有点色
--  发布时间:2017/6/12 14:51:00
--  

 改成这样


Dim doc As PrintDoc = e.Form.GernatePrintDoc()
Dim dyjm As String=Tables("赋值").rows(0)("装箱清单打印机")
Dim rt As prt.RenderText
rt = New prt.RenderText \'设置文本对象的内容
rt.Text = "第[PageNo]页,共[PageCount]页" \'设置文本内容
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'靠右对齐
rt.Style.Borders.Top = New prt.LineDef(0.3, Color.Green) \'设置底边框
rt.Style.Padding.Bottom = 0.5 \'底端内容缩进0.5毫米
rt.Style.FontSize = 8 \'字体大小为8磅
Doc.PageFooter = rt
\'e.Form.Page.PaperKind =11 \'纸张类型改为A5
Doc.PrinterName = dyjm   \'设置默认打印机
doc.AutoRotate = False

If Tables("赋值").rows(0)("直接打印判断")=True Then
    doc.Print()  \'打印
Else
    doc.Preview()  \'打印预览
End If


--  作者:yj1041132457
--  发布时间:2017/6/12 15:15:00
--  
搞定了,原来是打印机虽然放的是A5纸,但打印机的纸张大小设置还是A4纸才会扁那么厉害。麻烦有点色老师了 图片点击可在新窗口打开查看