以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 遍历怎么写 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=78504) |
-- 作者:cjl333333333 -- 发布时间:2015/12/10 13:50:00 -- 遍历怎么写 Dim doc As New PrintDoc() doc.PageSetting.PaperKind = 9 \'纸张类型 Doc.PageSetting.LeftMargin = 5 \'设置左边距 Doc.PageSetting.RightMargin = 5 \'设置右边距 Doc.PageSetting.TopMargin = 5 \'设置上边距 Doc.PageSetting.BottomMargin = 5 \'设置下边距 Dim AA As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1") Dim BB As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker2") Dim pg As WinForm.TabControl = e.Form.Controls("页签4") Dim n As String = pg.SelectedPage.Name Dim t As String = "生产计划_" & n Dim CurRow As Row = Tables(T).Current \'加入标题 Dim rx As New prt.RenderText \'定义一个文本对象 rx.text = "生产计划" rx.Style.FontBold = True \'字体加粗 rx.Style.FontSize = 16 \'大体大小为16磅 rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中排列 rx.Style.Spacing.Bottom = 3 \'和下面的对象(表格)距离3毫米 doc.Body.Children.Add(rx) \'加入到报表中 Dim rx1 As New prt.RenderText \'定义一个文本对象 rX1 = New prt.RenderText \'创建另一个文本对象 RX1.Text ="机台 :\'"& CURROW("机台") & "\'" \'设置文本内容 rx1.Style.FontBold = True \'字体加粗 rx1.Style.FontSize = 14 \'大体大小为16磅 RX1.y = "Prev.Bottom + 1" \'设置垂直位置 rx1.Style.Spacing.Bottom = 1 \'和下面的对象(表格)距离3毫米 doc.Body.Children.Add(RX1) \'将文本对象加入到报表 Dim rt As New prt.RenderTable \'定义一个新表格 RT.y = "Prev.Bottom + 4" \'设置垂直位置 Dim tb As Table = Tables(T) Tables(t).Filter = " 机台 = \'" & n & "\' AND 完工 = FALSE AND 序号 < 3" Dim ColNames As String() = New String(){"序号", "生产单号","产品资料","订单数量","核算单位","最迟完成时间","备注"} For c As Integer = 0 To ColNames.Length - 1 \'逐列设置和填入内容 rt.Cells(0,c).Text = ColNames(c) \'列名作为标题 rt.Cells(0,c).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中 rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth \'列宽等于实际列宽 If tb.Cols(ColNames(c)).IsNumeric OrElse tb.Cols(ColNames(c)).IsDate Then \'如果是数值或日期列 rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Right \'数据水平靠右 End If For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容 rt.Cells(r + 1, c).Text = tb.Rows(r)(ColNames(c)) Next Next rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) \'灰色网格线 rt.CellStyle.Spacing.All = 0.5 \'单元格内距设为0.5毫米 rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'第一行内容水平居中 rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All \'利用行组,将第一行设为表头 doc.Body.Children.Add(RT) Dim rx3 As New prt.RenderTable rx3.Cells(0,0).Text = Date.Today rx3.Cells(0,1).Text = " 计划人: 联系电话:667756" rx3.Cells(0,2).Text = "审核人" rx3.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Left rx3.Cols(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center rx3.Cols(2).Style.TextAlignHorz = prt.AlignHorzEnum.LEFT rx3.Cells(1,0).Text = " 日期:"&"\'"& Date.ToDAY &"\' 生产计划 " rx3.Style.Borders.Bottom = New prt.LineDef \'设置底边框 rx3.CellStyle.Spacing.Bottom = 0.5 \'底端内容缩进0.5毫米 rx3.Style.FontSize = 14 \'字体大小为8磅 Doc.PageFooter = rx3 \'作为页眉使用 doc.Preview() \'预览 以上代码只能打印当前页面的,我希望有个遍历,遍这整个页签的每个页面的内容进行打印,这个遍历要怎么写?
|
-- 作者:大红袍 -- 发布时间:2015/12/10 14:17:00 -- Dim pg As WinForm.TabControl = e.Form.Controls("页签4") For Each p As WinForm.TabPage In pg.TabPages |
-- 作者:大红袍 -- 发布时间:2015/12/10 14:17:00 -- 容器打印,直接写
http://www.foxtable.com/help/topics/2437.htm
|
-- 作者:cjl333333333 -- 发布时间:2015/12/11 14:27:00 -- 解决了,谢谢哦。 |