以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  预览重叠  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=121111)

--  作者:刘林
--  发布时间:2018/6/29 11:53:00
--  预览重叠

\'\'\'

Dim t1 As String= e.Form.Controls("textbox1").text

Dim t2 As String= e.Form.Controls("textbox2").text

Dim t3 As String= e.Form.Controls("textbox3").text

Dim dy As String = right(Date.Today.Year,1)

Dim dd As String = Date.Today.day

Dim dm As String = Date.Today.Month

Dim tb As Table=Tables("录取_table1")

Dim doc As New PrintDoc \'定义一个报表

Dim hr() As String = {"〇","一","二","三","四","五","六","七","八","九"}

Dim ye() As String = {"〇","一","二","三","四","五","六","七","八","九","十","十一","十二"}

Dim ri() As String = {"〇","一","二","三","四","五","六","七","八","九","十","十一","十二","十三","十四","十五","十六","十七","十八","十九","二十","二十一","二十二","二十三","二十四","二十五","二十六","二十七","二十八","二十九","三十","三十一"}

Dim hn As String = hr(dy)

Dim hm As String = ye(dm)

Dim hd As String = ri(dd)

Doc.PageSetting.Landscape=False

\'doc.PageSetting.Width = 285\'纸张宽度为100毫米

\'doc.PageSetting.Height = 216 \'纸张高度为120毫米

doc.PageSetting.PaperKind = 9

doc.PageSetting.Landscape = True

doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight

Doc.PageSetting.leftMargin = 0

Doc.PageSetting.rightMargin = 0

Doc.PageSetting.TopMargin  =0

Doc.PageSetting.BottomMargin  =0

\'doc.AutoRotate = False

If t1>"" And t2>"" And t3>""

    For i As Integer = tb.TopPosition To tb.BottomPosition

        Dim ra As New prt.RenderArea

        ra.Width = 285 \'宽度53毫米

        ra.Height = 216 \'高度24毫米

        ra.x=10

        ra.Style.Spacing.All = 0

        ra.Style.Borders.All = New prt.Linedef(0, Color.Red) \'设置边框

        ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never \'禁止水平分割

        ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'禁止垂直分割

        \'将容器加入到报表中

        Doc.Body.ChildRen.Add(ra)

       

        Dim rt As  New prt.RenderText

        rt.Text = tb.Rows(i)("报名号")

        rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)

        rt.Y =55

        rt.x=45

        ra.Children.Add(rt) \'添加到容器中

       

        rt = New prt.RenderText

        rt.Text = tb.Rows(i)("姓名")

        rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)

        rt.Y =73

        rt.x=45

        ra.Children.Add(rt) \'添加到容器中

        rt = New prt.RenderText

        rt.Text = tb.Rows(i)("考试号")

        rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)

        rt.Y =90

        rt.x=45

        ra.Children.Add(rt) \'添加到容器中

       

        rt = New prt.RenderText

        rt.Text = tb.Rows(i)("录取学校")

        rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)

        rt.Y =108

        rt.x=50

        ra.Children.Add(rt) \'添加到容器中

       

        rt = New prt.RenderText

        rt.Text = tb.Rows(i)("毕业学校")

        rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)

        rt.Y =144

        rt.x=50

        ra.Children.Add(rt) \'添加到容器中

       

        rt = New prt.RenderText

        rt.Text = dy

        rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)

        rt.Y =171

        rt.x=36

        ra.Children.Add(rt) \'添加到容器中

        rt = New prt.RenderText

        rt.Text = dm

        rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)

        rt.Y =171

        rt.x=50

        ra.Children.Add(rt) \'添加到容器

        rt = New prt.RenderText

        rt.Text = dd

        rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)

        rt.Y =171

        rt.x=61

        ra.Children.Add(rt) \'添加到容器中

        rt = New prt.RenderText

        rt.Text = tb.Rows(i)("毕业学校")

        rt.Style.Font=New Font("宋体", 18, FontStyle.Bold)

        rt.Y =15

        rt.x=130

        ra.Children.Add(rt) \'添加到容器中

        rt = New prt.RenderText

        rt.Text = tb.Rows(i)("姓名")

        rt.Style.Font=New Font("行楷", 18, FontStyle.Bold)

        rt.Y =78

        rt.x=160

        ra.Children.Add(rt) \'添加到容器中

       

        rt = New prt.RenderText

        rt.Text = tb.Rows(i)("报名号")

        rt.Style.Font=New Font("宋体", 18, FontStyle.Bold)

        rt.Y =55

        rt.x=160

        ra.Children.Add(rt) \'添加到容器中

        rt = New prt.RenderText

        rt.Text = tb.Rows(i)("姓名")

        rt.Style.Font=New Font("行楷", 18, FontStyle.Bold)

        rt.Y =78

        rt.x=160

        ra.Children.Add(rt) \'添加到容器中

       

        rt = New prt.RenderText

        rt.Text = tb.Rows(i)("录取学校")

        rt.Style.Font=New Font("行楷", 18, FontStyle.Bold)

        rt.Y =102

        rt.x=210

        ra.Children.Add(rt) \'添加到容器中

        rt = New prt.RenderText

        rt.Text = tb.Rows(i)("报名号").Substring(1,1)

        rt.Style.Font=New Font("宋体", 20, FontStyle.Bold)

        rt.Y =113

        rt.x=130

        ra.Children.Add(rt) \'添加到容器中

        rt = New prt.RenderText

        rt.Text = tb.Rows(i)("招生类别")

        rt.Style.Font=New Font("行楷", 18, FontStyle.Bold)

        rt.Y =113

        rt.x=150

        ra.Children.Add(rt) \'添加到容器中

        rt = New prt.RenderText

        rt.Text = tb.Rows(i)("报名号").Substring(1,1)

        rt.Style.Font=New Font("宋体", 20, FontStyle.Bold)

        rt.Y =125

        rt.x=130

        ra.Children.Add(rt) \'添加到容器中

       

        rt = New prt.RenderText

        rt.Text =t2  \'bmks

        rt.Style.Font=New Font("宋体", 20, FontStyle.Bold)

        rt.Y =125

        rt.x=165

        ra.Children.Add(rt) \'添加到容器中

       

        rt = New prt.RenderText

        rt.Text =t3  \'bmks

        rt.Style.Font=New Font("宋体", 20, FontStyle.Bold)

        rt.Y =125

        rt.x=190

        ra.Children.Add(rt) \'添加到容器中

        Dim ra1 As New prt.RenderArea

        ra1.Style.Borders.All = New prt.Linedef(0, Color.black) \'设置边

        ra1.width=149

        ra1.height =15

        ra1.x=118

        ra1.y=149

        ra.ChildRen.Add(ra1)

        rt = New prt.RenderText

        rt.Text ="    " & t1  \'bmks

        rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)

        ra1.Children.Add(rt) \'添加到容器中

        rt = New prt.RenderText

        rt.Text =hn  \'bmks

        rt.Style.Font=New Font("宋体", 20, FontStyle.Bold)

        rt.Y =172

        rt.x=204

        ra.Children.Add(rt) \'添加到容器中

        rt = New prt.RenderText

        rt.Text =hm  \'bmks

        rt.Style.Font=New Font("宋体", 20, FontStyle.Bold)

        rt.Y =172

        rt.x=221

        ra.Children.Add(rt) \'添加到容器中

       

        rt = New prt.RenderText

        rt.Text =hd  \'bmks

        rt.Style.Font=New Font("宋体", 20, FontStyle.Bold)

        rt.Y =172

        rt.x=240

        ra.Children.Add(rt) \'添加到容器中

    Next

   

   

    Doc.Preview() \'预览报表

   

Else

    messagebox.show("请设置好相关的时间及注意事项")

End If





上面预览内容只显示一张,内容重叠起的,是什么原因?

 


--  作者:有点甜
--  发布时间:2018/6/29 12:12:00
--  

1、这个代码删除

 

ra.x=10

 

2、我这样测试没问题

 

Dim tb As Table=Tables("表A")

Dim doc As New PrintDoc \'定义一个报表

Doc.PageSetting.Landscape=False

\'doc.PageSetting.Width = 285\'纸张宽度为100毫米

\'doc.PageSetting.Height = 216 \'纸张高度为120毫米

doc.PageSetting.PaperKind = 9

doc.PageSetting.Landscape = True

doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight

Doc.PageSetting.leftMargin = 0

Doc.PageSetting.rightMargin = 0

Doc.PageSetting.TopMargin  =0

Doc.PageSetting.BottomMargin  =0

\'doc.AutoRotate = False


For i As Integer = tb.TopPosition To tb.BottomPosition
   
    Dim ra As New prt.RenderArea
   
    ra.Width = 285 \'宽度53毫米
   
    ra.Height = 216 \'高度24毫米
   
    ra.Style.Spacing.All = 0
   
    ra.Style.Borders.All = New prt.Linedef(0, Color.Red) \'设置边框
   
    ra.SplitHorzBehavior = prt.SplitBehaviorEnum.Never \'禁止水平分割
   
    ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never \'禁止垂直分割
   
    \'将容器加入到报表中
   
    Doc.Body.ChildRen.Add(ra)
   
   
   
    Dim rt As  New prt.RenderText
   
    rt.Text = 111
   
    rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)
   
    rt.Y =55
   
    rt.x=45
   
    ra.Children.Add(rt) \'添加到容器中
   
   
   
    rt = New prt.RenderText
   
    rt.Text = 222
   
    rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)
   
    rt.Y =73
   
    rt.x=45
   
    ra.Children.Add(rt) \'添加到容器中
   
    rt = New prt.RenderText
   
    rt.Text = 333
   
    rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)
   
    rt.Y =90
   
    rt.x=45
   
    ra.Children.Add(rt) \'添加到容器中
   
   
   
    rt = New prt.RenderText
   
    rt.Text = 4444
   
    rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)
   
    rt.Y =108
   
    rt.x=50
   
    ra.Children.Add(rt) \'添加到容器中
   
   
   
    rt = New prt.RenderText
   
    rt.Text = 555
   
    rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)
   
    rt.Y =144
   
    rt.x=50
   
    ra.Children.Add(rt) \'添加到容器中
   
   
   
    rt = New prt.RenderText
   
    rt.Text = 6666
   
    rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)
   
    rt.Y =171
   
    rt.x=36
   
    ra.Children.Add(rt) \'添加到容器中
   
    rt = New prt.RenderText
   
    rt.Text = 7777
   
    rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)
   
    rt.Y =171
   
    rt.x=50
   
    ra.Children.Add(rt) \'添加到容器
   
    rt = New prt.RenderText
   
    rt.Text = 8888
   
    rt.Style.Font=New Font("宋体", 15, FontStyle.Bold)
   
    rt.Y =171
   
    rt.x=61
   
    ra.Children.Add(rt) \'添加到容器中
   
    rt = New prt.RenderText
   
    rt.Text = 9999
   
    rt.Style.Font=New Font("宋体", 18, FontStyle.Bold)
   
    rt.Y =15
   
    rt.x=130
   
    ra.Children.Add(rt) \'添加到容器中
   
    rt = New prt.RenderText
   
    rt.Text = 23434
   
    rt.Style.Font=New Font("行楷", 18, FontStyle.Bold)
   
    rt.Y =78
   
    rt.x=160
   
    ra.Children.Add(rt) \'添加到容器中
   
   
    Dim ra1 As New prt.RenderArea
   
    ra1.Style.Borders.All = New prt.Linedef(0, Color.black) \'设置边
   
    ra1.width=149
   
    ra1.height =15
   
    ra1.x=118
   
    ra1.y=149
   
    ra.ChildRen.Add(ra1)
   
   
   
   
   
Next

 

 

Doc.Preview() \'预览报表