-- 作者:易服
-- 发布时间:2011/3/3 12:09:00
-- [求助]专业报表显示列标题
此主题相关图片如下:2011-3-3 12-00-05.png
Dim Filter As String Dim cmb As WinForm.ComboBox=e.Form.Controls("ComboBox1") If cmb.Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "乡名= \'" & cmb.Value & "\'" End If
Dim dt As DataTable Dim g As New CrossTableBuilder("后台统计1", DataTables("申请表"),Filter) If cmb.Value IsNot Nothing Then g.HGroups.AddDef("村名") Else g.HGroups.AddDef("乡名") End If If e.Form.Controls("RadioButton2").Checked Then g.VGroups.AddDef("登记权利") Else g.VGroups.AddDef("林种") End If g.Totals.AddDef("面积") g.HorizontalTotal = True g.VerticalTotal = True g.FromServer = True \'后台 dt = g.Build(True)
Dim doc As New PrintDoc Dim rt As New prt.RenderTable Dim rs As New prt.RenderText() rt.Width = "Parent.Width" rt.Style.Spacing.Top = 4 \'表格和前面对象的垂直间隔为4毫米 rs.Text = "分乡登记权利(林种)面积统计表" rs.Style.Font = New Font("宋体",18,FontStyle.Bold) rs.Style.TextAlignHorz = prt.AlignHorzEnum.Center \'文本内容水平居中 Doc.PageHeader = rs \'作为页眉使用 \'设置页眉
Dim rt1 As prt.RenderText \'定义一个文本对象 rt1 = New prt.RenderText \'设置文本对象的内容 rt1.Text = "单位:亩.株.块" \'设置文本内容 rt1.Style.TextAlignHorz = prt.AlignHorzEnum.Right \'靠右对齐 rt1.Style.Borders.Bottom = New prt.LineDef(0.3, Color.Green) \'设置底边框 rt1.Style.Padding.Bottom = 0.5 \'底端内容缩进0.5毫米 rt1.Style.FontSize = 10 \'字体大小为8磅 doc.Body.Children.Add(rt1) \'将文本对象加入到表格中
Dim rx1 As New prt.RenderTable rx1.Cells(0,0).Text = "第[PageNo]页 共[PageCount]页" rx1.Style.TextAlignHorz = prt.AlignHorzEnum.Center rx1.CellStyle.Spacing.Bottom = 0.5 \'底端内容缩进0.5毫米 rx1.Style.FontSize = 10 \'字体大小为8磅 Doc.PageFooter = rx1 \'作为页脚使用
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()
|