此主题相关图片如下:报表图.jpg
我设置报表的时候,如果字段较少和报表宽度较小时,表格居中,但是这样设置达不到我要的效果,
我想让字段信息全部横向显示,把表格扩宽让字段全部显示,但是表格扩宽后它就自动向右靠,有些
字段就看不到了,我希望把它设置成,当表格太宽时与报表的宽度差不多,这样可以可以根据设置字体的
大小来设置全部显示。
请教:我代码如下:
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.all = 1
rx.Text = "卡利亚电镀厂员工工资信息表"
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
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
rt.CellStyle.Spacing.All = 1
rt.Width = 200 '设置表格的宽度为120毫米
rt.Style.Font = New Font("宋体", 6)
'rt.Height = 100 '设置表格的高度为100毫米
'rt.Style.Padding.all = 1 '上边距25毫米
rt.Style.Padding.Left = 1
rt.Cols.Count = 14
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.Cells(0,6).Text = "职务津贴"
rt.Cells(0,7).Text = "奖励"
rt.Cells(0,8).Text = "罚款"
rt.Cells(0,9).Text = "全勤奖金"
rt.Cells(0,10).Text = "加班工资"
rt.Cells(0,11).Text = "应发工资"
rt.Cells(0,12).Text = "实发工资"
rt.Cells(0,13).Text = "统计月份"
rt.rows(0).Style.Borders.Top = New prt.LineDef
rt.rows(0).Style.Borders.Bottom = New prt.LineDef
With Tables("员工工资统计_tb_pay")
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)("基本工资")
rt.Cells(r+1,6).Text = .rows(r)("职务津贴")
rt.Cells(r+1,7).Text = .rows(r)("奖励")
rt.Cells(r+1,8).Text = .rows(r)("罚款")
rt.Cells(r+1,9).Text = .rows(r)("全勤奖金")
rt.Cells(r+1,10).Text = .rows(r)("加班工资")
rt.Cells(r+1,11).Text = .rows(r)("应发工资")
rt.Cells(r+1,12).Text = .rows(r)("实发工资")
rt.Cells(r+1,13).Text = .rows(r)("统计月份")
rt.rows(r+1).Style.Borders.Bottom = New prt.LineDef
Next
End With
doc.Body.Children.Add(rt)
rx = New prt.RenderText
rx.Style.FontBold = False
rx.Style.Spacing.all = 1
rx.Text = "总数目: " & Tables("员工工资统计_tb_pay").Rows.Count
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right
doc.Body.Children.Add(rx)
doc.Preview