以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  下列代码如何把列名换成标题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=74988)

--  作者:lyfxybc
--  发布时间:2015/9/24 7:32:00
--  下列代码如何把列名换成标题

下列代码如何把列名换成标题

 

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     Caption
    For
r As integer = 0 To dt.DataRows.Count - 1
        rt.Cells(r +
1,Count).Text = dt.DataRows(r)(Col.Name)     Caption
    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()

[此贴子已经被作者于2015/9/24 7:34:08编辑过]

--  作者:大红袍
--  发布时间:2015/9/24 9:27:00
--  
For Each Col As DataCol In Dt.DataCols
    rt.Cells(0,Count).Text = Col.Caption
    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

--  作者:lyfxybc
--  发布时间:2015/9/24 21:04:00
--  
谢谢