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()
|