就是加了也不行,也不出错,不知什么原因,帮我看看是那里不对啦?
Dim doc As New Printdoc
Dim rx As prt.RenderText
Dim rt As prt.RenderTable
Dim Rows As List(Of DataRow)
Dim tbl As Table = Tables("地址")
Doc.PageSetting.LeftMargin = 10 '设置左边距
Doc.PageSetting.RightMargin = 10 '设置右边距
Doc.PageSetting.TopMargin = 20 '设置上边距
Doc.PageSetting.BottomMargin = 20 '设置下边距
For i as Integer = tbl.TopRow To tbl.BottomRow
rx = New prt.RenderText
rx.BreakBefore = prt.BreakEnum.Page '另起一页再打印
rx.Style.FontSize = 12
rx.Style.FontBold = True
rx.Style.Spacing.Bottom = 5
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rx.Text = "核查资料"
doc.Body.Children.Add(rx)
rt = New prt.RenderTable
rt.rows.count = 35
rt.Style.FontSize = 9
rt.Style.Padding.Left = 2 '左边距5毫米
rt.Style.Padding.right = 2 '左边距5毫米
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center
rt.Style.TextAlignVert = prt.AlignVertEnum.Center
rt.Style.Borders.Bottom = New prt.LineDef(0.3,Color.LightGray)
rt.CellStyle.Spacing.All = 0.5
rt.Style.GridLines.All = New prt.Linedef
rt.Cols.Count = 9
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.rows(0).Style.Borders.Top = New prt.LineDef(2,Color.LightGray)
rt.rows(0).Style.Borders.Bottom = New prt.LineDef(1,Color.LightGray)
dim r1 as row = tables("地址").rows(i)
Rows = dataTables("A").select("地址码 = '" & r1("地址码") & "'" , "生成房号")
For r As integer = 0 To Rows.Count - 1
If Rows(r)("状态") <> "有效" Then
rt.Cells(r + 1, 7).Style.BackColor = Color.Gray
rt.Cells(r + 1, 7).Style.FontBold = True
End If
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)("施工情况")
Next
doc.Body.Children.Add(rt)
rx = New prt.RenderText
rx.Style.FontBold = True
rx.Style.Spacing.Top = 3
rx.Text = "合计: " & Rows.Count
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right
doc.Body.Children.Add(rx)
Next
doc.Preview
[此贴子已经被作者于2009-5-28 11:05:59编辑过]