Foxtable(狐表)用户栏目专家坐堂 → 公式如何修改?


  共有1966人关注过本帖树形打印复制链接

主题:公式如何修改?

帅哥哟,离线,有人找我吗?
大雪山
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:297 积分:2984 威望:0 精华:0 注册:2008/9/29 10:13:00
公式如何修改?  发帖心情 Post By:2017/7/18 14:23:00 [只看该作者]


1. 序号问题 需修改成左单右双
2. 表头线右移对齐

 

 

'''
'---------------------------------------------------按条件加载
Dim tj,Filter,bdm,xhdm As String
If e.Form.Controls("加载条件").text = ""
    Filter = ""
Else
    tj = e.Form.Controls("加载条件").text
    tj = tj.Replace(vbcrlf,";").Replace(Chr(10),"").Replace(Chr(13),";").Replace(chr(-23636),",") '规范条件按格式
    Dim Values(),Value2s() As String
    Values = tj.split(";")
    For Index As Integer = 0 To Values.Length - 1
        bdm = Values(Index).split("\")(0)
        xhdm = Values(Index).split("\")(1)
        Filter = Filter & " or bdm = '" & bdm & "'"
        If xhdm <> "all"
            Filter = Filter.Replace(" or bdm = '" & bdm & "'","")
            Value2s = xhdm.split(",")
            For i As Integer = 0 To Value2s.Length - 1
                Filter =Filter &  " or bdm = '" & bdm & "' and xhdm = '" & Value2s(i) & "'"
            Next
        End If
    Next
    Filter = "&" & Filter
    Filter = Filter.Replace("& or ","")
End If
DataTables("student").LoadFilter = Filter
DataTables("student").Load
'------------------------------------------------生成报表
Dim top As Integer = getConfigValue("上边距",10)
Dim lft As Integer = getConfigValue("左边距",16)
Dim btm As Integer = getConfigValue("下边距",10)
Dim fl As Integer = getConfigValue("分栏距",6)
Dim zrs As Integer = 1
Dim dqh As Integer = Tables("student").Position
If getConfigValue("全部打印",True) = True
    zrs = DataTables("student").DataRows.Count
End If
Dim clr As Color = Color.White
If getConfigValue("填表模式",True) = False
    clr = Color.Black
End If
Dim s As String
Dim mxh,cnt As Integer
Dim dr As DataRow
Dim h As Integer = Top
'-------------------------------------------------------以下代码定义报表
Dim doc As New PrintDoc() '定义一个报表
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim rx As New prt.RenderText '定义一个文本对象
Dim ra As New prt.RenderArea '定义一个容器
doc.PageSetting.Width = 210 '纸张宽度为210毫米
doc.PageSetting.Height = 297 '纸张高度为120毫米
doc.AutoRotate = False '禁止自动旋转打印内容
doc.PageSetting.Landscape = False '横向打印
Doc.PageSetting.TopMargin = top '设置上边距
Doc.PageSetting.LeftMargin = lft '设置左边距
Doc.PageSetting.BottomMargin = btm '设置下边距

Dim drs As List(Of DataRow)
For rn As Integer = 0 To zrs - 1
    If getConfigValue("全部打印",True) = True
        dqh = rn
    End If
    dr = Tables("student").Rows(dqh).DataRow
    drs = dr.GetChildRows("ksxx")
    If drs.Count = 0
        Continue For
    End If
    rt = New prt.RenderTable() '定义一个表格对象
    rx = New prt.RenderText '定义一个文本对象
    ra = New prt.RenderArea '定义一个容器
    ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never  '禁止容器因为分页而被垂直分割
    ra.Width = "177mm"
    rt.Style.GridLines.All = New prt.LineDef(clr) '将网格线类型设为默认类型Color.White
    rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中
    rt.Style.Spacing.Top = 5 '表格和前面对象的垂直间隔为5毫米
    rt.Style.Spacing.Bottom = 5 '表和和后续对象的垂直间隔为5毫米
    rt.Style.Spacing.All = 2 '所有表格内边距为2mm
    rt.Style.Borders.all = New prt.Linedef(0,Color.White)
   
    rt.Style.TextColor = Color.Black
    rt.Cols(0).Width = 14 & "mm"
    rt.Cols(1).Width = 6 & "mm"
    rt.Cols(2).Width = 25 & "mm"
    rt.Cols(3).Width = 10 & "mm"
    rt.Cols(4).Width = 15 & "mm"
    rt.Cols(5).Width = 15 & "mm"
    rt.Cols(6).Width = 7 & "mm"
    rt.Cols(7).Width = 8 & "mm"
    rt.Cols(8).Width = 7 & "mm"
    rt.Cols(9).Width = 7 & "mm"
    rt.Cols(10).Width = 9 & "mm"
    rt.Cols(11).Width = 8 & "mm"
    rt.Cols(12).Width = 8 & "mm"
    rt.Cols(13).Width = 7 & "mm"
    rt.Cols(14).Width = 7 & "mm"
    rt.Cols(15).Width = 17 & "mm"
    
    
    
   

 rt.Rows(rt.Rows.Count).Height = 14
    rt.Rows(rt.Rows.Count-1).Style.GridLines.all = New prt.Linedef(0,Color.White)
    rt.Rows(rt.Rows.Count-1).Style.GridLines.Top = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.left = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,13).Style.GridLines.left = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,0).SpanCols = 13  '向右合并13列
    rt.Cells(rt.Rows.Count-1,0).Text =  getConfigValue("学校名称","请先选择学校名称!")
    rt.Cells(rt.Rows.Count-1,0).Style.Font = New Font("宋体", 14, FontStyle.Regular)
    rt.Rows(rt.Rows.Count).Height = 14
    rt.Rows(rt.Rows.Count-1).Style.GridLines.all = New prt.Linedef(0,Color.White)
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.left = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,13).Style.GridLines.left = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,0).SpanCols = 13 '向右合并13列
    rt.Cells(rt.Rows.Count-1,0).Text = getConfigValue("证件名称","请先选择证件名称!")
    rt.Cells(rt.Rows.Count-1,0).Style.Font = New Font("黑体", 20, FontStyle.Regular)
    rt.Cells(rt.Rows.Count-1,0).Style.TextColor = clr   
   
   
   
    rt.Rows(rt.Rows.Count).Height = 7
    rt.Rows(rt.Rows.Count-1).Style.GridLines.Top = New prt.Linedef(0.2,clr)
    rt.Rows(rt.Rows.Count-1).Style.TextColor = clr
    rt.Rows(rt.Rows.Count-1).Style.Font = New Font("黑体", 10, FontStyle.Regular)
    rt.Cells(rt.Rows.Count-1,0).SpanCols = 1 '向右合并2列
    rt.Cells(rt.Rows.Count-1,0).Text = "序号"
    rt.Cells(rt.Rows.Count-1,1).SpanCols = 2 '向右合并2列
    rt.Cells(rt.Rows.Count-1,1).Text = "学 号"
    rt.Cells(rt.Rows.Count-1,3).SpanCols = 2 '向右合并2列
    rt.Cells(rt.Rows.Count-1,3).Text = "姓 名"
   
    rt.Cells(rt.Rows.Count-1,5).SpanCols = 1 '向右合并2列
    rt.Cells(rt.Rows.Count-1,5).Text = "成绩"
    rt.Cells(rt.Rows.Count-1,6).SpanCols = 2 '向右合并2列
    rt.Cells(rt.Rows.Count-1,6).Text = "序号"
    rt.Cells(rt.Rows.Count-1,8).SpanCols = 4 '向右合并2列
    rt.Cells(rt.Rows.Count-1,8).Text = "学 号"
    rt.Cells(rt.Rows.Count-1,12).SpanCols = 3 '向右合并2列
    rt.Cells(rt.Rows.Count-1,12).Text = "姓 名"
    rt.Cells(rt.Rows.Count-1,15).SpanCols = 1 '向右合并2列
    rt.Cells(rt.Rows.Count-1,15).Text = "成绩"
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.left = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,15).Style.GridLines.Right = New prt.Linedef(0.5,clr)
    ' drs = DataTables("打印").Select("xhdm = '" & dr("xhdm") & "'","专业,专业")  '改动
    drs = DataTables("打印").Select("专业 = '" & dr("xhdm") & "'","专业,专业")  '改动
    cnt = drs.Count
    mxh = Math.Max(10,cnt)
   
   
    Dim xuhao As Integer = 1
    For i As Integer = 0 To mxh - 1
        rt.Rows(rt.Rows.Count).Height = 5
        rt.Rows(rt.Rows.Count-1).Style.Font = New Font("宋体", 10, FontStyle.Regular)
        rt.Cells(rt.Rows.Count-1,0).SpanCols = 1 '向右合并2列
        rt.Cells(rt.Rows.Count-1,1).SpanCols = 2 '向右合并2列
        rt.Cells(rt.Rows.Count-1,3).SpanCols = 2 '向右合并2列
        rt.Cells(rt.Rows.Count-1,5).SpanCols = 1 '向右合并2列
        rt.Cells(rt.Rows.Count-1,6).SpanCols = 2 '向右合并2列
        rt.Cells(rt.Rows.Count-1,8).SpanCols = 4 '向右合并2列
       
       
        rt.Cells(rt.Rows.Count-1,12).SpanCols = 3 '向右合并2列
        rt.Cells(rt.Rows.Count-1,15).SpanCols = 1 '向右合并2列
        rt.Cells(rt.Rows.Count-1,0).Style.GridLines.left = New prt.Linedef(0.5,clr)
        rt.Cells(rt.Rows.Count-1,15).Style.GridLines.Right = New prt.Linedef(0.5,clr)
        If i < cnt
           
           
            rt.Cells(rt.Rows.Count-1,1).Text = drs(i)("xhdm")
            rt.Cells(rt.Rows.Count-1,3).Text = drs(i)("sname")
            Dim dr1 As DataRow = DataTables("student").find("xhdm = '" & drs(i)("sid") & "'")
            If dr1 IsNot Nothing
                rt.Cells(rt.Rows.Count-1,0).Text = xuhao
                xuhao = xuhao+2
                rt.Cells(rt.Rows.Count-1,6).Text = dr1("sid")
            End If
            i+=1
           
            If i<cnt Then
                rt.Cells(rt.Rows.Count-1,6).Text = xuhao
                xuhao = xuhao+2
                rt.Cells(rt.Rows.Count-1,8).Text = drs(i)("xhdm")
                rt.Cells(rt.Rows.Count-1,12).Text = drs(i)("sname")
                '   Dim dr1 As DataRow = DataTables("student").find("xhdm = '" & drs(i)("sid") & "'")
                If dr1 IsNot Nothing
                    rt.Cells(rt.Rows.Count-1,8).Text = dr1("sname")
                End If
            End If
           
           
        End If
    Next
    rt.Rows(rt.Rows.Count).Height = 3
    rt.Rows(rt.Rows.Count-1).Style.Spacing.All = 0 '所有表格内边距为1mm
    rt.Rows(rt.Rows.Count-1).Style.Font = New Font("宋体", 10, FontStyle.Regular)
    rt.Cells(rt.Rows.Count-1,0).SpanCols = 16 '向右合并2列
    rt.rows(rt.Rows.Count-1).Style.GridLines.all = New prt.Linedef(0,Color.White)
    rt.rows(rt.Rows.Count-1).Style.GridLines.Top = New prt.Linedef(0.2,clr)
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.left = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.Right = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,0).Style.TextAlignHorz = prt.AlignHorzEnum.left
    rt.Cells(rt.Rows.Count-1,0).text = "1、考生凭缴费收据领取加盖公章的《准考证》,考试时凭准考证、身份证、学生证参加考试。"
    rt.Cells(rt.Rows.Count-1,0).Style.TextColor = clr
   
    rt.Rows(rt.Rows.Count).Height = 3
    rt.Rows(rt.Rows.Count-1).Style.Spacing.All = 0 '所有表格内边距为1mm
    rt.Rows(rt.Rows.Count-1).Style.Font = New Font("宋体", 10, FontStyle.Regular)
    rt.Cells(rt.Rows.Count-1,0).SpanCols = 16 '向右合并2列
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.left = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.Right = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,0).Style.TextAlignHorz = prt.AlignHorzEnum.left
    rt.Cells(rt.Rows.Count-1,0).text = "2、考生进入试场时须将书本资料存放到指定位置,不得带入试场。自觉关闭通讯工具,不得喧哗,吸烟。"
    rt.Cells(rt.Rows.Count-1,0).Style.TextColor = clr
   
    rt.Rows(rt.Rows.Count).Height = 3
    rt.Rows(rt.Rows.Count-1).Style.Spacing.All = 0 '所有表格内边距为1mm
    rt.Rows(rt.Rows.Count-1).Style.Font = New Font("宋体", 10, FontStyle.Regular)
    rt.Cells(rt.Rows.Count-1,0).SpanCols = 16 '向右合并2列
    rt.rows(rt.Rows.Count-1).Style.GridLines.all = New prt.Linedef(0,Color.White)
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.left = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.Right = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,0).Style.TextAlignHorz = prt.AlignHorzEnum.left
    rt.Cells(rt.Rows.Count-1,0).text = "3、须提前15分钟进入考室、对应学号及座位号入座。"
    rt.Cells(rt.Rows.Count-1,0).Style.TextColor = clr
   
   
    rt.Rows(rt.Rows.Count).Height = 3
    rt.Rows(rt.Rows.Count-1).Style.Spacing.All = 0 '所有表格内边距为1mm
    rt.Rows(rt.Rows.Count-1).Style.Font = New Font("宋体", 10, FontStyle.Regular)
    rt.Cells(rt.Rows.Count-1,0).SpanCols = 16 '向右合并2列
    rt.Cells(rt.Rows.Count-1,0).Style.TextAlignHorz = prt.AlignHorzEnum.left
    rt.Cells(rt.Rows.Count-1,0).text = "4、考试时在试卷规定的地方准确填写学号、姓名、座位号(不填写座位号或座位号填错成绩无效)"
    rt.rows(rt.Rows.Count-1).Style.GridLines.all = New prt.Linedef(0,Color.White)
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.left = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.Right = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,0).Style.TextColor = clr
   
    rt.Rows(rt.Rows.Count).Height = 1
    rt.Cells(rt.Rows.Count-1,0).SpanCols = 5 '向右合并2列
    rt.Cells(rt.Rows.Count-1,6).SpanCols = 8 '向右合并2列
    rt.rows(rt.Rows.Count-1).Style.GridLines.all = New prt.Linedef(0,Color.White)
    rt.Cells(rt.Rows.Count-1,6).Style.GridLines.top = New prt.Linedef(0.2,clr)
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.left = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,15).Style.GridLines.Right = New prt.Linedef(0.5,clr)
    rt.Rows(rt.Rows.Count).Height = 5
    rt.Rows(rt.Rows.Count-1).Style.Font = New Font("黑体", 10, FontStyle.Regular)
    rt.Cells(rt.Rows.Count-1,0).SpanCols = 2 '向右合并2列
    rt.Cells(rt.Rows.Count-1,0).text = "考试地点:"
    rt.Cells(rt.Rows.Count-1,0).Style.TextColor = clr
   
    rt.Cells(rt.Rows.Count-1,2).SpanCols = 6 '向右合并列
    rt.Cells(rt.Rows.Count-1,2).Style.TextAlignHorz = prt.AlignHorzEnum.left
    rt.Cells(rt.Rows.Count-1,2).text = getConfigValue("考试地点",Nothing)
    rt.Cells(rt.Rows.Count-1,10).SpanCols = 5 '向右合并列
    rt.Cells(rt.Rows.Count-1,10).Style.TextAlignHorz = prt.AlignHorzEnum.Right
    rt.Cells(rt.Rows.Count-1,10).Style.Font = New Font("宋体", 10, FontStyle.Regular)
    Dim Day As Date = getConfigValue("制证时间",Date.Today())
    rt.Cells(rt.Rows.Count-1,10).text = "准考证制作时间是:"
    rt.Cells(rt.Rows.Count-1,10).Style.TextColor = clr
   
    rt.Cells(rt.Rows.Count-1,15).text = format(day,"y")
    rt.Cells(rt.Rows.Count-1,15).Style.Spacing.All = 0
    rt.Cells(rt.Rows.Count-1,15).Style.TextAlignHorz = prt.AlignHorzEnum.left
   
    rt.rows(rt.Rows.Count-1).Style.GridLines.all = New prt.Linedef(0,Color.White)
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.left = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,15).Style.GridLines.Right = New prt.Linedef(0.5,clr)
    rt.Rows(rt.Rows.Count).Height = fl
    rt.Cells(rt.Rows.Count-1,0).SpanCols = 16 '向右合并列
    rt.rows(rt.Rows.Count-1).Style.GridLines.all = New prt.Linedef(0,Color.White)
    rt.rows(rt.Rows.Count-1).Style.GridLines.Top = New prt.Linedef(0.5,clr)
    rt.Cells(rt.Rows.Count-1,0).Style.GridLines.Right = New prt.Linedef(0,Color.White)
    ra.Children.Add(rt) '加入到容器中
    Doc.Body.ChildRen.Add(ra) '将容器加入到报表中
Next
s = Nothing
If getConfigValue("启用水印",True) = True
    rx = New prt.RenderText '设置文本对象的内容
    For i As Integer = 1 To getConfigValue("水印数",1)
        s = s & getConfigValue("学校名称","请先选择学校名称!") & vbcrlf & vbcrlf & vbcrlf
    Next
    s = s & "&&"
    s = s .Replace(vbcrlf & vbcrlf & vbcrlf & "&&","")
    rx.Text = s '设置文本内容
    rx.Width = "Parent.Width" '宽度等于页面宽度
    rx.Height = "Parent.Height" '高度等于页面高度
    rx.Style.TextAngle = 45 '旋转45度
    rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中对齐
    rx.Style.TextAlignVert = prt.AlignVertEnum.Center '垂直居中对齐
    rx.Style.FontSize = 22 '字体大小为8磅
    rx.Style.TextColor = Color.Gray '文本颜色为灰色
    Doc.WaterMark = rx '作为水印使用
End If
If GetConfigValue("打印预览",True) = True
    Doc.Preview() '预览报表
Else
    doc.Print
End If
'------------------------------------加载全部数据
DataTables("student").LoadFilter = ""
DataTables("student").Load

 

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

 

 


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/7/18 14:35:00 [只看该作者]

Dim dr1 As DataRow = DataTables("student").find("xhdm = '" & drs(i)("sid") & "'")
If dr1 IsNot Nothing
    rt.Cells(rt.Rows.Count-1,0).Text = xuhao
    xuhao = xuhao+2
    rt.Cells(rt.Rows.Count-1,6).Text = dr1("sid")
End If

改成

 

rt.Cells(rt.Rows.Count-1,0).Text = xuhao
xuhao = xuhao+1

Dim dr1 As DataRow = DataTables("student").find("xhdm = '" & drs(i)("sid") & "'")

If dr1 IsNot Nothing
    rt.Cells(rt.Rows.Count-1,6).Text = dr1("sid")
End If


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/7/18 14:36:00 [只看该作者]

rt.Cells(rt.Rows.Count-1,0).SpanCols = 13  '向右合并13列

 

改成

 

rt.Cells(rt.Rows.Count-1,0).SpanCols = 16


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/7/18 14:37:00 [只看该作者]

 不会做,上传具体例子测试。

 回到顶部
帅哥哟,离线,有人找我吗?
大雪山
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:297 积分:2984 威望:0 精华:0 注册:2008/9/29 10:13:00
  发帖心情 Post By:2017/7/18 15:10:00 [只看该作者]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:成人教育2.table


图片点击可在新窗口打开查看此主题相关图片如下:h8x@(i`7}{phos5i5pg8qf.png
图片点击可在新窗口打开查看
问题 1 右侧是双号 2 边线


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/7/18 16:14:00 [只看该作者]

 

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:成人教育2.table


 回到顶部