Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
看着帮助中的:
1,sql语句
2,分组
3,绑定
能力有限而写不出来了....
--
'''
dim barow as row = tables("表A").current
dim babianhao as string = barow("编号")
Dim Names As New List(Of String)
Dim suzhu() As String '定义数组
Dim bfrows As List(Of Datarow)
bfrows = DataTables("表F").select("[编号] = '"& babianhao &"'")
for each bfrow as datarow in bfrows
Names.Add(bfrow("项目"))
next
suzhu = Names.ToArray()
output.show(suzhu(0))
Dim doc As New PrintDoc
Dim rt As prt.RenderTable
With Tables("表A.表F")
rt = New prt.RenderTable
rt.Style.GridLines.All = prt.Linedef.Default '网格线为默认类型
For n As integer = 0 To .Rows.Count - 1
rt.Cells(0,0).Text = "编号"
rt.Cells(0,1).Text ="采样编号"
rt.Cells(0,2+n).Text = .rows(n)("项目")
next
End With
doc.Body.Children.Add(rt)
Dim cmd As New SQLCommand '定义一个SQL命令
Dim dt As DataTable '定义一个数据表变量
cmd.CommandText = "Select 编号,采样编号,值 from {表C} where 编号 = '"& babianhao &"' and 项目= '"& suzhu(0) &"' "
dt = cmd.ExecuteReader() '生成一个临时表
dim Count As Integer = 0
rt = New prt.RenderTable
For Each Col AS DataCol In Dt.DataCols
rt.Cells(0,Count).Text = Col.Name
For r As integer = 0 To dt.DataRows.Count - 1
rt.Cells(r +1,Count).Text = dt.DataRows(r)(Col.Name)
Next
Count = Count + 1
Next
doc.Body.Children.Add(rt)
doc.Preview()
因为项目是不断(减小或增加) 为了避免当增加1个项目,就要更改表结构和报表。
试了1天1晚时间了,终于写出来了(分享1下):
dim barow as row = tables("表A").current
dim babianhao as string = barow("编号")
Dim doc As New Printdoc
Dim rt As New prt.RenderTable
dim af as table = Tables("表A.表F")
With Tables("表A.表F")
rt = New prt.RenderTable
rt.Style.GridLines.All = prt.Linedef.Default '网格线为默认类型
For n As integer = 0 To .Rows.Count - 1
rt.Cells(0,0).Text = "编号"
rt.Cells(0,1).Text ="采样编号"
rt.Cells(0,2+n).Text = .rows(n)("项目")
Dim cmd As New SQLCommand '定义一个SQL命令
Dim dt As DataTable '定义一个数据表变量
cmd.CommandText = "Select 编号,采样编号,值 from {表C} where 编号 = '"& babianhao &"' and 项目= '"& Tables("表A.表F").rows(n)("项目") &"' "
dt = cmd.ExecuteReader() '生成一个临时表
For r As integer = 0 To dt.DataRows.Count - 1
rt.Cells(r+1,0).Text = dt.DataRows(r)("编号")
rt.Cells(r+1,1).Text = dt.DataRows(r)("采样编号")
rt.Cells(r+1,2+n).Text = dt.DataRows(r)("值")
Next
next
End With
doc.Body.Children.Add(rt)
doc.Preview
改全部用foxtable的语言写:(因用外部数据库,打印前已加载数据,再用select语句从后台找数据是效率的重复)
下载信息 [文件大小: 下载次数: ] | |
点击浏览该文件:管理项目2.table |
'''
Dim doc As New Printdoc
dim barow as row = tables("表A").current
dim babianhao as string = barow("编号")
Dim rt As prt.RenderTable
With Tables("表A.表F")
rt = New prt.RenderTable
rt.Style.GridLines.All = prt.Linedef.Default '网格线为默认类型
For n As integer = 0 To .Rows.Count - 1
rt.Cells(0,0).Text = "编号"
rt.Cells(0,1).Text ="采样编号"
rt.Cells(0,2+n).Text = .rows(n)("项目")
Dim bctbl As dataTable = dataTables("表C")
dim bcrows as list(of datarow)
bcrows = bctbl.select("[编号] = '"& babianhao &"' and [项目]= '"& Tables("表A.表F").rows(n)("项目") &"' ")
for bci as integer = 0 to bcrows.count -1
for each bcrow as datarow in bcrows
rt.Cells(1+bci,0).Text = bcrows(bci)("编号")
rt.Cells(1+bci,1).Text = bcrows(bci)("采样编号")
rt.Cells(1+bci,2+n).Text = bcrows(bci)("值")
next
next
next
end with
doc.Body.Children.Add(rt)
doc.Preview()