以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  请问如何写合并相同单元格的代码呀  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=22994)

--  作者:周子杰
--  发布时间:2012/8/29 17:10:00
--  请问如何写合并相同单元格的代码呀


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

 

请指教:我想变成如下格式:

  

  faby    pian     年  日报    晚报    
   曹晓玲    城西  2012      233    477    
   狄文斌    城西  2012    151    377    

 

原代码如下:

Dim dt As DataTable
Dim g As New GroupTableBuilder("统计表1", DataTables("fenfa"))
g.Groups.AddDef("faby")
g.Groups.AddDef("pian")
g.Groups.AddDef("zzrq", DateGroupEnum.Year, "年")
g.Groups.AddDef("baom")
g.Totals.AddDef("fens")
g.Filter = "[zzrq] >= \'1/1/2012 \' And [zzrq] <= \'12/31/2012 \' And [pian] = \'城西 \'"
g.FromServer = True
dt = g.Build(True)
Dim doc As New PrintDoc
Dim rt As New prt.RenderTable
Dim Count As Integer = 0
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
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
rt.CellStyle.Spacing.All = 1
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
doc.Body.Children.Add(rt)
doc.Preview()


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

http://www.foxtable.com/help/topics/2049.htm

 


--  作者:周子杰
--  发布时间:2012/9/3 18:19:00
--  
狐爸,放在一起就不会用了,请给个提示吧!
--  作者:周子杰
--  发布时间:2012/9/3 18:21:00
--  

Dim dt As DataTable
Dim g As New GroupTableBuilder("统计表1", DataTables("fenfa"))
g.Groups.AddDef("faby")
g.Groups.AddDef("pian")
g.Groups.AddDef("zzrq", DateGroupEnum.Year, "年")
g.Groups.AddDef("baom")
g.Totals.AddDef("fens")
g.Filter = "[zzrq] >= \'1/1/2012 \' And [zzrq] <= \'12/31/2012 \' And [pian] = \'城西 \'"
g.FromServer = True
dt = g.Build(True)
Dim doc As New PrintDoc
Dim rt As New prt.RenderTable
Dim Count As Integer = 0
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
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
rt.CellStyle.Spacing.All = 1
rt.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center
doc.Body.Children.Add(rt)
doc.Preview()

上面代码和您给的代码,不会组合了,请给提示