以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  专业报表设计  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=72252)

--  作者:kaituozhe
--  发布时间:2015/7/27 5:13:00
--  专业报表设计

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Dim doc As New Printdoc
Dim rx As prt.RenderText
Dim rt As prt.RenderTable
Doc.PageSetting.LeftMargin = 10 \'设置左边距
Doc.PageSetting.RightMargin = 10 \'设置右边距
Doc.PageSetting.TopMargin = 20 \'设置上边距
Doc.PageSetting.BottomMargin = 20 \'设置下边距
rx = New prt.RenderText
rx.Style.FontSize = 8
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 3
rx.Text = "户名: " & Tables("查证汇总表").Current("户名")
doc.Body.Children.Add(rx)

rt = New prt.RenderTable
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Style.TextAlignVert = prt.AlignVertEnum.Center
rt.Style.Borders.Bottom = New prt.LineDef(0.3,Color.LightGray)

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(1,Color.LightGray)
rt.rows(0).Style.Borders.Bottom = New prt.LineDef(1,Color.LightGray)
With Tables("查证汇总表.查证明细表")
    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.Bottom = New prt.LineDef(0.3,Color.black)
       
    Next
End With
doc.Body.Children.Add(rt)

rx = New prt.RenderText
rx.Style.FontBold = True
rx.Style.Spacing.Top = 3
rx.Text = "数目: " & Tables("查证汇总表.查证明细表").Rows.Count
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right
doc.Body.Children.Add(rx)
doc.Preview

执行上述代码的时候会有以下提示

 

列“交易日期”不属于表 查证汇总表。不知道什么原因,求教


--  作者:大红袍
--  发布时间:2015/7/27 9:08:00
--  
以下是引用kaituozhe在2015/7/27 5:13:00的发言:

 

 执行上述代码的时候会有以下提示

 

列“交易日期”不属于表 查证汇总表。不知道什么原因,求教

 

提示已经很明显了,就是你的列名写错了,或者就是不存在此列。


--  作者:lyzhuo
--  发布时间:2015/12/1 21:44:00
--  
收藏