以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  专业报表中实际打印的数据与表格中显示的数据不致  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=80791)

--  作者:kaituozhe
--  发布时间:2016/2/1 16:57:00
--  专业报表中实际打印的数据与表格中显示的数据不致
专业报表中实际打印的数据与表格中显示的数据不致,出现错行是什么原因,比如鼠标在第5行,实际数据是第六行的是什么原因
--  作者:大红袍
--  发布时间:2016/2/1 17:00:00
--  

 应该是表名写错了,注意看是不是副本表的情况。


--  作者:kaituozhe
--  发布时间:2016/2/1 17:09:00
--  

一个父表与一个子表,父表中户名为张三,打印出来的子表明细李四


--  作者:大红袍
--  发布时间:2016/2/1 17:10:00
--  
上传实例。
--  作者:kaituozhe
--  发布时间:2016/2/1 17:15:00
--  

Dim tbl As Table = Tables("查询汇总表")
For i As Integer = tbl.TopRow To tbl.BottomRow
    Dim doc As New Printdoc
    Dim rx As prt.RenderText
    Dim rx1 As prt.RenderText
    Dim rt As prt.RenderTable
    Dim Rows As List(Of DataRow)
     Dim s As String
    doc.PageSetting.Landscape = True \'横向打印
    Doc.PageSetting.LeftMargin = 10 \'设置左边距
    Doc.PageSetting.RightMargin = 10 \'设置右边距
    Doc.PageSetting.TopMargin = 30 \'设置上边距
    Doc.PageSetting.BottomMargin = 20 \'设置下边距
    rx1 = New prt.RenderText
    rx1.BreakBefore = prt.BreakEnum.Page \'另起一页再打印
    rx1.Style.FontSize = 14
    rx1.Style.FontBold = True
    rx1.Style.Spacing.Bottom = 5
    rx1.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中
    rx1.Text =  tbl.Rows(i)("序号") & "、" & tbl.Rows(i)("报案人") & "损失资金确认表"
    doc.Body.Children.Add(rx1)
    rx = New prt.RenderText
    rx.Style.FontSize = 12
    rx.Style.FontBold = True
    rx.Style.Spacing.Bottom = 5
    rx.Style.TextIndent = 9 \'首行缩进9毫米
    rx.Style.LineSpacing = 200 \'设置双倍行距
     rx.Text =  "基本情况: " & tbl.Rows(i)("查询人")& "," & tbl.Rows(i)("性别") & "," & tbl.Rows(i)("年龄")  & "," & tbl.Rows(i)("身份证号") & "," & tbl.Rows(i)("常住住址") & "," & tbl.Rows(i)("工作单位") & "。详细情况如下表:"
    doc.Body.Children.Add(rx)
   
    rt = New prt.RenderTable
    rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All \'将第一行作为表头
    rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center
    rt.Style.Borders.Bottom = New prt.LineDef(0.2,Color.LightGray)
    rt.Style.GridLines.All = New prt.Linedef
    rt.CellStyle.Spacing.All = 1
    rt.Cols.Count = 9
    rt.Cells(0,0).Text = "交易日期"
    rt.Cells(0,1).Text = "交易账号"
    rt.Cells(0,2).Text = "交易卡号"
    rt.Cells(0,3).Text = "交易户名"
    rt.Cells(0,4).Text = "交易内容"
    rt.Cells(0,5).Text = "借方金额"
    rt.Cells(0,6).Text = "贷方金额"
    rt.Cells(0,7).Text = "余额"
    rt.Cells(0,8).Text = "对方户名"
    rt.Cells(0,9).Text = "对方账号"
    rt.rows(0).Style.Borders.Top = New prt.LineDef(0.5,Color.black)
    rt.rows(0).Style.Borders.Bottom = New prt.LineDef(0.5,Color.LightGray)
      Rows =DataTables("查询明细表").SQLSelect("查询人1= \'" & Tables("查询汇总表").DataTable.dataRows(i)("查询人") & "\'")
     For r As Integer = 0 To Rows.Count - 1
        rt.Cells(r+1,0).Text = rows(r)("交易日期")
        rt.Cells(r+1,1).Text = rows(r)("交易账号")
        rt.Cells(r+1,2).Text = rows(r)("交易卡号")
        rt.Cells(r+1,3).Text = rows(r)("交易户名")
        rt.Cells(r+1,4).Text = rows(r)("交易内容")
        rt.Cells(r+1,5).Text = rows(r)("借方金额")
        rt.Cells(r+1,6).Text = rows(r)("贷方金额")
        rt.Cells(r+1,7).Text = rows(r)("余额")
        rt.Cells(r+1,8).Text = rows(r)("对方户名")
        rt.Cells(r+1,9).Text = rows(r)("对方账号")
        rt.rows(r+1).Style.Borders.Top = New prt.LineDef(0.3,Color.black)
    Next

doc.Preview() \'预览
Next


--  作者:kaituozhe
--  发布时间:2016/2/1 17:15:00
--  

Dim tbl As Table = Tables("查询汇总表")
For i As Integer = tbl.TopRow To tbl.BottomRow
    Dim doc As New Printdoc
    Dim rx As prt.RenderText
    Dim rx1 As prt.RenderText
    Dim rt As prt.RenderTable
    Dim Rows As List(Of DataRow)
     Dim s As String
    doc.PageSetting.Landscape = True \'横向打印
    Doc.PageSetting.LeftMargin = 10 \'设置左边距
    Doc.PageSetting.RightMargin = 10 \'设置右边距
    Doc.PageSetting.TopMargin = 30 \'设置上边距
    Doc.PageSetting.BottomMargin = 20 \'设置下边距
    rx1 = New prt.RenderText
    rx1.BreakBefore = prt.BreakEnum.Page \'另起一页再打印
    rx1.Style.FontSize = 14
    rx1.Style.FontBold = True
    rx1.Style.Spacing.Bottom = 5
    rx1.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'水平居中
    rx1.Text =  tbl.Rows(i)("序号") & "、" & tbl.Rows(i)("查询人") & "损失资金确认表"
    doc.Body.Children.Add(rx1)
    rx = New prt.RenderText
    rx.Style.FontSize = 12
    rx.Style.FontBold = True
    rx.Style.Spacing.Bottom = 5
    rx.Style.TextIndent = 9 \'首行缩进9毫米
    rx.Style.LineSpacing = 200 \'设置双倍行距
     rx.Text =  "基本情况: " & tbl.Rows(i)("查询人")& "," & tbl.Rows(i)("性别") & "," & tbl.Rows(i)("年龄")  & "," & tbl.Rows(i)("身份证号") & "," & tbl.Rows(i)("常住住址") & "," & tbl.Rows(i)("工作单位") & "。详细情况如下表:"
    doc.Body.Children.Add(rx)
   
    rt = New prt.RenderTable
    rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All \'将第一行作为表头
    rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center
    rt.Style.Borders.Bottom = New prt.LineDef(0.2,Color.LightGray)
    rt.Style.GridLines.All = New prt.Linedef
    rt.CellStyle.Spacing.All = 1
    rt.Cols.Count = 9
    rt.Cells(0,0).Text = "交易日期"
    rt.Cells(0,1).Text = "交易账号"
    rt.Cells(0,2).Text = "交易卡号"
    rt.Cells(0,3).Text = "交易户名"
    rt.Cells(0,4).Text = "交易内容"
    rt.Cells(0,5).Text = "借方金额"
    rt.Cells(0,6).Text = "贷方金额"
    rt.Cells(0,7).Text = "余额"
    rt.Cells(0,8).Text = "对方户名"
    rt.Cells(0,9).Text = "对方账号"
    rt.rows(0).Style.Borders.Top = New prt.LineDef(0.5,Color.black)
    rt.rows(0).Style.Borders.Bottom = New prt.LineDef(0.5,Color.LightGray)
      Rows =DataTables("查询明细表").SQLSelect("查询人1= \'" & Tables("查询汇总表").DataTable.dataRows(i)("查询人") & "\'")
     For r As Integer = 0 To Rows.Count - 1
        rt.Cells(r+1,0).Text = rows(r)("交易日期")
        rt.Cells(r+1,1).Text = rows(r)("交易账号")
        rt.Cells(r+1,2).Text = rows(r)("交易卡号")
        rt.Cells(r+1,3).Text = rows(r)("交易户名")
        rt.Cells(r+1,4).Text = rows(r)("交易内容")
        rt.Cells(r+1,5).Text = rows(r)("借方金额")
        rt.Cells(r+1,6).Text = rows(r)("贷方金额")
        rt.Cells(r+1,7).Text = rows(r)("余额")
        rt.Cells(r+1,8).Text = rows(r)("对方户名")
        rt.Cells(r+1,9).Text = rows(r)("对方账号")
        rt.rows(r+1).Style.Borders.Top = New prt.LineDef(0.3,Color.black)
    Next

doc.Preview() \'预览
Next


--  作者:大红袍
--  发布时间:2016/2/1 17:17:00
--  

Rows =DataTables("查询明细表").SQLSelect("查询人1= \'" & Tables("查询汇总表").DataTable.dataRows(i)("查询人") & "\'")

 

改成

 

Rows =DataTables("查询明细表").SQLSelect("查询人1= \'" & Tables("查询汇总表").Rows(i)("查询人") & "\'")


--  作者:kaituozhe
--  发布时间:2016/8/8 12:50:00
--  

Dim tbl As Table = Tables("合同分表_table1")
For i As Integer = tbl.TopRow To tbl.BottomRow
Dim Rows As List(Of DataRow)
Dim Doc As new PrintDoc()
Dim rt As new prt.rendertable
Dim rx As new prt.RenderText
rx.style.Font = new font("宋体",16)
rx.style.TextAlignHorz = prt.AlignHorzEnum.Center
rx.Style.Spacing.Bottom = 3
rx.text = "银行交易明细"
Doc.body.Children.Add(rx)
rt.rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center \'唯独第一列内容居中
rt.Style.TextAlignVert = prt.AlignVertEnum.Center \'垂直居中
rt.RowGroups(0,1).Style.BackColor = Color.LightGray \'第三第四行的颜色设为灰色
rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All  \'前四行作为表头
rt.style.Font = new font("宋体",9)
rt.style.GridLines.all = new prt.LineDef
rt.Cols(1).Width = 32
rt.Cols(2).Width = 32
rt.Cols(8).Width = 32
rt.Cols(10).Width = 12
rt.Cols(11).Width = 32
rt.cells(0,0).text="交易日期"
rt.cells(0,1).text="银行账号"
rt.cells(0,2).text="银行卡号"
rt.cells(0,3).text="交易户名"
rt.cells(0,4).text="交易内容"
rt.cells(0,5).text="借方金额"
rt.cells(0,6).text="借方金额"
rt.cells(0,7).text="余额"
rt.cells(0,8).text="对方账号"
rt.cells(0,9).text="对方户名"
rt.cells(0,10).text="地点号"
rt.cells(0,11).text="交易机构"
Dim t As Table = Tables("合同分表_table3")
Rows =DataTables("查证明细").Select("合同编号= \'" & tbl.Rows(i)("合同编号") & "\'")
msgbox(rows.Count-1)
For n As Integer = 0 To rows.Count-1
rt.Rows(n).Height = 7
    rt.cells(n+1,0).text= rows(n)("交易日期")
    rt.cells(n+1,1).text= rows(n)("银行账号")
    rt.cells(n+1,2).text= rows(n)("银行卡号")
    rt.cells(n+1,3).text= rows(n)("交易户名")
    rt.cells(n+1,4).text= rows(n)("交易内容")
    If rows(n)("借方金额") = 0 Then
        rt.cells(n+1,5).text= Nothing
    Else
        rt.cells(n+1,5).text= rows(n)("借方金额")
    End If
    If t.rows(n)("贷方金额") = 0 Then
        rt.cells(n+1,6).text= Nothing
    Else
        rt.cells(n+1,6).text= rows(n)("贷方金额")
    End If
    rt.cells(n+1,7).text= rows(n)("余额")
    rt.cells(n+1,8).text= rows(n)("对方账号")
    rt.cells(n+1,9).text= rows(n)("对方户名")
    rt.cells(n+1,10).text= rows(n)("地点号")
    rt.cells(n+1,11).text= rows(n)("交易机构")
    rt.cells(n+1,5).Style.TextAlignHorz = prt.AlignHorzEnum.Right
    rt.cells(n+1,6).Style.TextAlignHorz = prt.AlignHorzEnum.Right
    rt.cells(n+1,7).Style.TextAlignHorz = prt.AlignHorzEnum.Right
   
Next
rt.Rows(rows.Count).Height = 7
Doc.body.Children.Add(rt)
Dim rx1 As New prt.RenderTable
rx1.Cells(0,0).Text = Date.Today
rx1.Cells(0,1).Text = "银行交易明细"
rx1.Cells(0,2).Text = "第[PageNo]页,共[PageCount]页"
rx1.Cols(0).Style.TextAlignHorz = prt.AlignHorzEnum.Left
rx1.Cols(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
rx1.Cols(2).Style.TextAlignHorz = prt.AlignHorzEnum.right
rx1.Style.Borders.Bottom = New prt.LineDef \'设置底边框
rx1.CellStyle.Spacing.Bottom = 0.5 \'底端内容缩进0.5毫米
rx1.Style.FontSize = 9 \'字体大小为8磅
Doc.PageHeader = rx1 \'作为页眉使用

Doc.PageSetting.LeftMargin = 10 \'设置左边距
Doc.PageSetting.RightMargin = 10 \'设置右边距
Doc.PageSetting.TopMargin = 10 \'设置上边距
Doc.PageSetting.BottomMargin = 10 \'设置下边距
doc.PageSetting.Landscape = True
Doc.preview()
Next


--  作者:kaituozhe
--  发布时间:2016/8/8 12:51:00
--  

以上代码打印出的表格内容顺序与实际顺序不一致,是什么原因,怎么修改?


--  作者:大红袍
--  发布时间:2016/8/8 14:17:00
--  

Rows =DataTables("查证明细").Select("合同编号= \'" & tbl.Rows(i)("合同编号") & "\'")

 

改成

 

Rows =DataTables("查证明细").Select("合同编号= \'" & tbl.Rows(i)("合同编号") & "\'", "_Sortkey, _Identify")