以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]窗口打印页眉页脚如何设置 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=100309) |
||||
-- 作者:ajie5211 -- 发布时间:2017/5/9 13:43:00 -- [求助]窗口打印页眉页脚如何设置 窗口打印页眉页脚如何设置,因为表设置了自动换行,如果设置最大行时,有时一张纸太空,有时又打不全。有没有办法单独设置? |
||||
-- 作者:有点色 -- 发布时间:2017/5/9 14:51:00 -- 参考这个例子
http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=96192&skin=0
|
||||
-- 作者:ajie5211 -- 发布时间:2017/5/9 15:42:00 -- 以下是引用有点色在2017/5/9 14:51:00的发言:
参考这个例子
http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=96192&skin=0
帮我看一下这个自动换行怎么办,还有页脚在哪调整。 此主题相关图片如下:qq截图20170509153939.png 此主题相关图片如下:qq截图20170509154014.png |
||||
-- 作者:ajie5211 -- 发布时间:2017/5/9 15:42:00 -- 代码见下: Dim grp As WinForm.GroupBox = e.Form.Controls("GroupBox1") |
||||
-- 作者:有点色 -- 发布时间:2017/5/9 15:50:00 -- 例子上传上来。 |
||||
-- 作者:ajie5211 -- 发布时间:2017/5/9 16:30:00 -- 附件请查看。
|
||||
-- 作者:有点色 -- 发布时间:2017/5/9 16:56:00 -- Dim grp As WinForm.GroupBox = e.Form.Controls("GroupBox1") Dim dylk As String = "下单日期|45|销售单号|105|业务员|50|品名规格|160|P数|30|数量|45|总线数|45|出货日期|38|备注|185|客户|50|组别|45|塑件材料状况|50|计划生产日|45|完成日期|40|五金材料状况|60" Dim cvs As String = Tables("订单计划一览表").GetColVisibleWidth() Tables("订单计划一览表").SetColVisibleWidth(cvs) Tables("订单计划一览表").SetColVisibleWidth(dylk) \'Tables("订单计划一览表").AutoSizeRows() e.Form.Controls("Label9").text = Date.Now e.Form.Page.PaperKind = 9 e.Form.Page.LeftMargin = 2 \'设置左边距 e.Form.Page.RightMargin = 0 \'设置右边距 e.Form.Page.TopMargin = 2 \'设置上边距 e.Form.Page.BottomMargin = 0 \'设置下边距 e.Form.Page.Landscape = True Dim doc As PrintDoc = e.Form.GernatePrintDoc(grp) Dim ndoc As new PrintDoc ndoc.PageSetting.PaperKind = 9 ndoc.PageSetting.LeftMargin = 0 \'设置左边距 ndoc.PageSetting.RightMargin = 0 \'设置右边距 ndoc.PageSetting.TopMargin = 8 \'设置上边距 ndoc.PageSetting.BottomMargin = 2 \'设置下边距 ndoc.PageSetting.Landscape = True Dim ra_1 As new prt.RenderArea Dim ra_2 As new prt.RenderArea Dim ra_3 As new prt.RenderArea Dim flag As Boolean = False For Each c As object In Doc.Body.Children If c.Gettype.name Like "*RenderText*" Then If flag = False Then ra_1.Children.Add(c.Clone) Dim nrt = c.clone nrt.height = 0 ra_2.Children.Add(nrt) Else ra_2.Children.Add(c.clone) End If ElseIf c.Gettype.name Like "*RenderTable*" Then ra_3.Children.Add(c.Clone) Dim nrt = c.clone nrt.height = 0 ra_2.Children.Add(nrt) flag = True End If Next ndoc.Body.Children.Add(ra_3) nDoc.PageHeader = ra_1 \'作为页眉使用 ndoc.PageFooter = ra_2 ndoc.Preview() Tables("订单计划一览表").SetColVisibleWidth(cvs) Tables("订单计划一览表").AutoSizeRows() |
||||
-- 作者:ajie5211 -- 发布时间:2017/5/9 17:32:00 -- 可以了, 谢谢! |
||||
-- 作者:ajie5211 -- 发布时间:2017/5/27 10:11:00 -- 以下是引用有点色在2017/5/9 16:56:00的发言:
Dim grp As WinForm.GroupBox = e.Form.Controls("GroupBox1") Dim dylk As String = "下单日期|45|销售单号|105|业务员|50|品名规格|160|P数|30|数量|45|总线数|45|出货日期|38|备注|185|客户|50|组别|45|塑件材料状况|50|计划生产日|45|完成日期|40|五金材料状况|60" Dim cvs As String = Tables("订单计划一览表").GetColVisibleWidth() Tables("订单计划一览表").SetColVisibleWidth(cvs) Tables("订单计划一览表").SetColVisibleWidth(dylk) \'Tables("订单计划一览表").AutoSizeRows() e.Form.Controls("Label9").text = Date.Now e.Form.Page.PaperKind = 9 e.Form.Page.LeftMargin = 2 \'设置左边距 e.Form.Page.RightMargin = 0 \'设置右边距 e.Form.Page.TopMargin = 2 \'设置上边距 e.Form.Page.BottomMargin = 0 \'设置下边距 e.Form.Page.Landscape = True Dim doc As PrintDoc = e.Form.GernatePrintDoc(grp) Dim ndoc As new PrintDoc ndoc.PageSetting.PaperKind = 9 ndoc.PageSetting.LeftMargin = 0 \'设置左边距 ndoc.PageSetting.RightMargin = 0 \'设置右边距 ndoc.PageSetting.TopMargin = 8 \'设置上边距 ndoc.PageSetting.BottomMargin = 2 \'设置下边距 ndoc.PageSetting.Landscape = True Dim ra_1 As new prt.RenderArea Dim ra_2 As new prt.RenderArea Dim ra_3 As new prt.RenderArea Dim flag As Boolean = False For Each c As object In Doc.Body.Children If c.Gettype.name Like "*RenderText*" Then If flag = False Then ra_1.Children.Add(c.Clone) Dim nrt = c.clone nrt.height = 0 ra_2.Children.Add(nrt) Else ra_2.Children.Add(c.clone) End If ElseIf c.Gettype.name Like "*RenderTable*" Then ra_3.Children.Add(c.Clone) Dim nrt = c.clone nrt.height = 0 ra_2.Children.Add(nrt) flag = True End If Next ndoc.Body.Children.Add(ra_3) nDoc.PageHeader = ra_1 \'作为页眉使用 ndoc.PageFooter = ra_2 ndoc.Preview() Tables("订单计划一览表").SetColVisibleWidth(cvs) Tables("订单计划一览表").AutoSizeRows() 这个页脚太靠下了,打印时常出不来。有啥办法吗? |
||||
-- 作者:ajie5211 -- 发布时间:2017/5/27 12:14:00 -- 版主,页脚太靠下了,打印时常出不来,看看啊! |