以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]条形码如何放在标签下面  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=82602)

--  作者:czgtiger
--  发布时间:2016/3/21 14:55:00
--  [求助]条形码如何放在标签下面
rt.cells(0,0).text ="Toplon Industrial Co., Ltd"
  rt.cells(0,0).Style.Font = New Font("宋体", 14, FontStyle.Bold)
 doc.Body.Children.Add(rt)
            Dim rbc As New prt.RenderBarCode()
            rbc.Height = 2
            rbc.BarCodeType = BarCodeEnum.Code39
            rbc.BarDirection = BarDirectionEnum.Normal
            rbc.Text = r("样品编号")
            doc.Body.Children.Add(rbc)


图片点击可在新窗口打开查看此主题相关图片如下:qq图片20160321145416.png
图片点击可在新窗口打开查看

目的想让条形码放在标签内容的下面,代码如何修改呢?


--  作者:大红袍
--  发布时间:2016/3/21 15:17:00
--  

本来就是放在下面的。肯定是你设置了排列方式 doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight

 

贴出完整代码测试。


--  作者:czgtiger
--  发布时间:2016/3/21 15:46:00
--  
 Dim doc As New PrintDoc \'定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight \'设置排列方式
For Each r As  Row In Tables("标签打印_table1").GetCheckedRows()
        For i As Integer = 1 To r("份")
            Dim rt As New prt.RenderTable() \'定义一个表格对象
            rt.Style.TextAlignHorz = prt.AlignHorzEnum.left \'水平居中
            rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中
            rt.style.GridLines.bottom = new prt.linedef
            rt.style.gridlines.horz = new prt.linedef
            rt.style.Padding.Top = 2
            rt.Style.Spacing.Right = 18
            rt.style.spacing.Top =4
            rt.Width = 88 \'表格宽度为80mm
            rt.cellStyle.Spacing.All = 0.3 \'和其他对象之间的间隔为2mm
             rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'避免垂直换页的时候,表格被分割成两部分.
            rt.Cols(0).Width = 35
            rt.Cells(0,0).SpanCols =2
            rt.cells(0,0).text ="Toplon Industrial Co., Ltd"
            rt.cells(0,0).Style.Font = New Font("宋体", 14, FontStyle.Bold)
            rt.cells(2,0).Text = "DESIGN NO."
            rt.cells(2,1).text = r("样品编号")
            rt.cells(2,0).Style.Font = New Font("宋体", 10)
            rt.cells(2,1).Style.Font = New Font("宋体", 10)
            rt.Cells(4,0).Text = "COMPOSITION"
            rt.cells(4,1).text = r("成份")
            rt.cells(4,0).Style.Font = New Font("宋体", 10)
            rt.cells(4,1).Style.Font = New Font("宋体", 10)
            rt.Cells(6,0).Text= "WIDTH"
            doc.Body.Children.Add(rt)
            Dim rbc As New prt.RenderBarCode()
            rbc.Height = 5
            rbc.style.Padding.Top = 0.5
            rbc.BarCodeType = BarCodeEnum.Code39
            rbc.BarDirection = BarDirectionEnum.Normal
            rbc.Text = r("样品编号")
            doc.Body.Children.Add(rbc)
            
        Next
    Next
目标功能:实现标签打印,一排两个,每张纸打印12个

--  作者:大红袍
--  发布时间:2016/3/21 16:10:00
--  

把条码作为表格的一部分,比如代码

 

Dim doc As New PrintDoc \'定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
For i As Integer = 1 To 2
    Dim rt As New prt.RenderTable() \'定义一个表格对象
    doc.Body.Children.Add(rt) \'将表格对象加入到报表中
    \'设置各位置的网格线
    rt.Style.GridLines.All = New Prt.LineDef(0.5, Color.Black)
    rt.width = 50
    \'下面的代码向表格中填入值
    rt.cells(0,0).text = 1
    rt.cells(1,0).text = 2
    rt.cells(2,0).text = 3
    Dim rbc As New prt.RenderBarCode()
    rbc.Height = 5
    rbc.style.Padding.Top = 0.5
    rbc.BarCodeType = BarCodeEnum.Code39
    rbc.BarDirection = BarDirectionEnum.Normal
    rbc.Text = "123"
    rt.cells(3,0).RenderObject = rbc
Next
doc.Preview() \'预览报表