以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]如何自动按考场打印 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=13103) |
||||
-- 作者:bohe -- 发布时间:2011/9/27 20:17:00 -- [求助]如何自动按考场打印
是用筛选吗? |
||||
-- 作者:mr725 -- 发布时间:2011/9/27 20:23:00 -- 可以 |
||||
-- 作者:bohe -- 发布时间:2011/9/28 7:24:00 --
用筛选(见高三表)我还是不能搞定自动打印,如何实现一页一个考场,报表全部显示,想打那一部分都可以,就如同word打印一样,请高手指定。 [此贴子已经被作者于2011-9-28 7:25:40编辑过]
|
||||
-- 作者:狐狸爸爸 -- 发布时间:2011/9/28 8:00:00 -- For each v as String in DataTables(“xxx”).GetUniqueValues("","考场") tables("XXX").Filter = "考场 = \'" & v & "\'" \'打印代码 Next |
||||
-- 作者:bohe -- 发布时间:2011/9/28 8:29:00 -- 以下是引用狐狸爸爸在2011-9-28 8:00:00的发言:
For each v as String in DataTables(“xxx”).GetUniqueValues("","考场") tables("XXX").Filter = "考场 = \'" & v & "\'" \'打印代码 Next 能对我的代码改一下吗? 我不想显示一个打一个,我想预览所有的,然后打印时选择 |
||||
-- 作者:狐狸爸爸 -- 发布时间:2011/9/28 8:41:00 -- Dim kc As Integer With CurrentTable Dim kct As Row = .Rows(0) Dim kcw As Row = .Rows(.Rows.Count-1) Dim i As Integer Dim doc As New PrintDoc .StopRedraw For i = kct("考场") To kcw("考场") .Filter = "[考场] = " & cstr(i) Dim rt As prt.RenderText Dim img As prt.RenderImage Dim Bar As New BarCodeBuilder doc.PageSetting.PaperKind = 9 Doc.PageSetting.LeftMargin = 9 \'设置左边距 Doc.PageSetting.RightMargin = 5 \'设置右边距 Doc.PageSetting.TopMargin = 9 \'设置上边距 Doc.PageSetting.BottomMargin = 4 \'设置下边 Bar.Symbology = Barpro.Symbology.Code128 Bar.Barwidth=0.45 Bar.BarRatio = 2 Bar.BarHeight = 10 Bar.BottomMargin = 1 Bar.Font = New Font("宋体",10.5) Bar.Code128CharSet = Barpro.Code128.C Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight For Each r As Row In .Rows Dim ra As New prt.RenderArea \'Dim rt As prt.RenderText ra.Width = 48.5 \'宽度53毫米 ra.Height = 25.5 \'高度24毫米 ra.Style.Padding.Top=5 ra.Style.Padding.Left=6 ra.style.Spacing.All=0 ra.Style.Borders.All = New prt.Linedef(0, Color.LightGray) \'设置边框 \'ra.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'ra.Style.TextAlignVert = prt.AlignVertEnum.Center ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never \'禁止水平分割 ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'禁止垂直分割 Doc.Body.ChildRen.Add(ra) \'将容器加入 bar.Code = r("考生号") Bar.HumanReadableText =r("姓名") & " " & r("考生号") \'Bar.SaveImage("f:\\txm2011\\MyBar.jpg") img = new prt.RenderImage img.Image = bar.GetImage ra.Children.Add(img) kc=r("考场") Next rt = New prt.RenderText \'设置文本对象的内容 rt.Text = "高一第" & cstr(kc) & "考场 ." \'设置文本内容 rt.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'靠右对齐 rt.Style.Padding.Bottom = 20 \'底端内容缩进0.5毫米 rt.Style.TextColor = Color.Red rt.Style.FontSize = 14 \'字体大小为8磅 rt.BreakAfter=prt.BreakEnum.Page Doc.PageFooter = rt \'作为页眉使用 .Filter = "" Next .ResumeRedraw Doc.Preview() End With |
||||
-- 作者:bohe -- 发布时间:2011/9/28 9:20:00 -- 还是不行噢,乱了 |
||||
-- 作者:狐狸爸爸 -- 发布时间:2011/9/28 9:45:00 -- 方法已经给出,请自行调整。 |
||||
-- 作者:bohe -- 发布时间:2011/9/28 9:56:00 -- 6楼代码不行,不是按考场来的 [此贴子已经被作者于2011-9-28 9:56:25编辑过]
|
||||
-- 作者:狐狸爸爸 -- 发布时间:2011/9/28 10:08:00 -- With CurrentTable Dim doc As New PrintDoc doc.PageSetting.PaperKind = 9 Doc.PageSetting.LeftMargin = 9 \'设置左边距 Doc.PageSetting.RightMargin = 5 \'设置右边距 Doc.PageSetting.TopMargin = 9 \'设置上边距 Doc.PageSetting.BottomMargin = 4 \'设置下边 For Each s As String In DataTables("高三").GetUniqueValues("","考场") Dim rt As prt.RenderText Dim img As prt.RenderImage Dim Bar As New BarCodeBuilder Bar.Symbology = Barpro.Symbology.Code128 Bar.Barwidth=0.45 Bar.BarRatio = 2 Bar.BarHeight = 10 Bar.BottomMargin = 1 Bar.Font = New Font("宋体",10.5) Bar.Code128CharSet = Barpro.Code128.C Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight For Each r As DataRow In DataTables("高三").Select("考场 = \'" & s & "\'") Dim ra As New prt.RenderArea ra.Width = 48.5 \'宽度53毫米 ra.Height = 25.5 \'高度24毫米 ra.Style.Padding.Top=5 ra.Style.Padding.Left=6 ra.style.Spacing.All=0 ra.Style.Borders.All = New prt.Linedef(0, Color.LightGray) \'设置边框 ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never \'禁止水平分割 ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'禁止垂直分割 bar.Code = r("考生号") Bar.HumanReadableText =r("姓名") & " " & r("考生号") img = new prt.RenderImage img.Image = bar.GetImage ra.Children.Add(img) Doc.Body.ChildRen.Add(ra) \'将容器加入 Next rt = New prt.RenderText \'设置文本对象的内容 rt.Text = "高一第" & s & "考场 ." \'设置文本内容 rt.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'靠右对齐 rt.Style.Padding.Bottom = 20 \'底端内容缩进0.5毫米 rt.Style.TextColor = Color.Red rt.Style.FontSize = 14 \'字体大小为8磅 rt.BreakAfter=prt.BreakEnum.Page Doc.Body.ChildRen.Add(rt) \'将容器加入 Next Doc.Preview() End With |