以下内容为程序代码:
1 Dim doc As New PrintDoc
2 doc.PageSetting.PaperKind = 9 '设置A4
3 Doc.PageSetting.LeftMargin = 5 '设置左边距
4 Doc.PageSetting.RightMargin = 5 '设置右边距
5 Doc.PageSetting.TopMargin = 5 '设置上边距
6 Doc.PageSetting.BottomMargin = 5 '设置下边距
7 Dim rt As New prt.RenderTable
8 rt.Width = "60" '设置表格的宽度为120毫米
9 rt.Height = "auto" '设置表格的高度为100毫米
10 rt.Style.GridLines.All = New prt.LineDef
11 Dim tb As Table = Tables("商品列表1")
12 Dim ColNames As String() = New String(){"商品编号", "库存数量"}
13 Doc.Columns.Add() '增加第一栏
14 Doc.Columns.Add()
15 Doc.Columns.Add()
16 For c As Integer = 0 To ColNames.Length -1
17 rt.Cells(0,c).Text = ColNames(c)
18 rt.Cols(c).Width = tb.Cols(ColNames(c)).PrintWidth
19 rt.Cells(1, c).Text = "[Fields!" & ColNames(c) & ".Value]" '设置绑定表达式
20 rt.Cells(0,1).Text = "库存数量"
21 rt.Cells(0,2).Text = "盘数"
22 rt.Cells(0,3).Text = "称重"
23 Next
24 rt.Style.TextAlignVert = prt.AlignHorzEnum.Center
25 rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center
26 rt.RowGroups(0,1).Style.TextAlignVert = prt.AlignVertEnum.Center '第一行内容垂直居中
27 rt.RowGroups(0,1).Header = prt.TableHeaderEnum.All '将第一行作为表头.
28 rt.RowGroups(1,1).DataBinding.DataSource = BindTables("商品列表1") '将第二行绑定到订单表
29 doc.Body.Children.Add(rt)
30 doc.Preview()
31 End If
怎么调节后面的两个列的宽度 中间的数量不要那么宽?
此主题相关图片如下:qq截图20170607210600.png
[此贴子已经被作者于2017/6/7 21:07:00编辑过]