以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  专业报表中,关联表的问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=20836)

--  作者:飞天
--  发布时间:2012/6/21 0:48:00
--  专业报表中,关联表的问题
我根据示例文件中做了一个关联表的\'专业报表\'
Dim doc As New Printdoc
Dim rx As prt.RenderText
Dim rt As prt.RenderTable

rx = New prt.RenderText
rx.Style.FontSize = 14
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 5
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 = 4
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.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)("金额")
        \'If .rows(r)("中止") = True Then
            \'Dim rm As New prt.RenderImage
           \' rm.Image = getImage("Check.Ico")
           \' rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center
          \'  rm.Style.ImageAlign.StretchHorz = False
          \'  rm.Style.ImageAlign.StretchVert = False
          \'  rt.Cells(r+1,5).RenderObject = rm
       \' End If
    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


图片点击可在新窗口打开查看此主题相关图片如下:qq截图20120620232906.png
图片点击可在新窗口打开查看我希望表头是以表格的形式显示:订单编号\\客户名称\\订单日期......
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:专业报表.table


请问,代码应该怎么修改?


--  作者:狐狸爸爸
--  发布时间:2012/6/21 8:11:00
--  

Dim doc As New Printdoc
Dim rx As prt.RenderText
Dim rt As prt.RenderTable

rx = New prt.RenderText
rx.Style.FontSize = 14
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 5
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.GridLines.All = New prt.Linedef \'设置网格线
rt.CellStyle.Spacing.All = 1
rt.Cols.Count = 4
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 = "金额"
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)("金额")
    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


--  作者:飞天
--  发布时间:2012/6/21 9:09:00
--  
狐爸,您给的这个代码,没有什么区别呀.

--  作者:狐狸爸爸
--  发布时间:2012/6/21 9:10:00
--  
你不是要显示表格线吗?
--  作者:飞天
--  发布时间:2012/6/21 10:21:00
--  
 狐爸,我是希望做的关联表像这样子的,
图片点击可在新窗口打开查看此主题相关图片如下:333.jpg
图片点击可在新窗口打开查看

例子的数据表和这个一样.麻烦帮忙看看好吗