以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  报表问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=95043)

--  作者:刘林
--  发布时间:2017/1/9 9:15:00
--  报表问题
Dim doc As New PrintDoc \'定义一个报表
Doc.PageSetting.LeftMargin = 15 \'设置左边距
Doc.PageSetting.RightMargin = 15 \'设置右边距
Doc.PageSetting.TopMargin = 15 \'设置上边距
Doc.PageSetting.BottomMargin = 15 \'

Dim tb As Table = Tables("通知书打印_table1")
\'\'Dim zd As String() = New String(){"姓名", "语文", "数学","综合","总分"}
\'\'Dim xs As String() = new String(){"姓名", "语文", "数学","综合总分","语数总分"}
For Each r As Row In Tables("通知书打印_table1")
    Dim rt As New prt.RenderText \'定义一个文本对象
    rt.Text = "通知书" \'设置文本对象的内容
    rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中
    rt.Style.Font = New Font("黑体", 30, FontStyle.Bold) \'设置字体
    doc.Body.Children.Add(rt) \'将文本对象加入到报表
    Dim rt1 As New prt.RenderText
    rt1.Text = r("姓名") & "学生家长:"
    rt1.Style.Font = New Font("黑体", 20)
    doc.Body.Children.Add(rt1)
    Dim rt2 As new prt.rendertext
    rt2.text = "    " & e.Form.Controls("TextBox1").text
    rt2.Style.Font = New Font("楷体", 20)
    doc.Body.Children.Add(rt2)
    Dim rt3 As new prt.rendertext
    rt3.text ="    现将学生在校基本情况通知于下:"
    rt3.Style.Font = New Font("楷体", 20)
    doc.Body.Children.Add(rt3)
    Dim rt4 As New prt.RenderTable() \'定义一个表格对象
    doc.Body.Children.Add(rt4) \'
    rt4.Style.GridLines.All = New prt.Linedef
    rt4.Style.Font = New Font("楷体", 20)
    For c As Integer = 4 To tb.Cols.Count -1  \'逐列设置和填入内容
        If tb.Cols(c).Visible Then
            rt4.Cells(0,c-4).Text =  tb.Cols(c).Name  \'列名作为标题
            rt4.Cells(0,c-4).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中
            rt4.Cells(1,c-4).Style.TextAlignHorz = prt.AlignHorzEnum.Center
           \' If e.Form.Controls("RadioButton1").checked = True
                rt4.cells(1,c-4).text = r(tb.Cols(c).Name)
            \'End If
        End If
    Next    
Next
doc.Preview() \'预览



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



老师我在窗口中做了checkbox来选通知中成绩打印字段,出现中间空两列,请问如何改


--  作者:有点色
--  发布时间:2017/1/9 9:21:00
--  
    Dim iii As Integer = 0
    For c As Integer = 4 To tb.Cols.Count -1  \'逐列设置和填入内容
        If tb.Cols(c).Visible Then
            rt4.Cells(0,iii).Text =  tb.Cols(iii).Name  \'列名作为标题
            rt4.Cells(0,iii).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'标题内容水平居中
            rt4.Cells(1,iii).Style.TextAlignHorz = prt.AlignHorzEnum.Center
            iii = iii + 1
        End If
    Next