哦,这样子,好的,谢谢!
想追问下,如果用专业报表可以控制这种效果吗?
我用专业报表试了下,建了“窗口1”测试,
代码是这样子的:
以下内容为程序代码:
1 Dim doc As New Printdoc
2 Dim rx As prt.RenderText
3 Dim rt As prt.RenderTable
4
5 rx = New prt.RenderText
6 rx.Style.FontSize = 14
7 rx.Style.FontBold = True
8 rx.Style.Spacing.Bottom = 5
9 rx.Text = Tables("本人信息").Current("姓氏") & "氏宗谱行传"
10 doc.Body.Children.Add(rx)
11
12 rt = New prt.RenderTable
13 rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center
14 rt.Style.TextAlignVert = prt.AlignVertEnum.Center
15 rt.Style.Borders.Bottom = New prt.LineDef(0.3,Color.LightGray)
16 rt.CellStyle.Spacing.All = 1
17 rt.Cols.Count = 13
18 rt.Cells(0,0).Text = "世"
19 rt.Cells(0,1).Text = "号"
20 rt.Cells(0,2).Text = "上代直系辈字?名"
21 rt.Cells(0,3).Text = "上代世号"
22 rt.Cells(0,4).Text = "第几子"
23 rt.Cells(0,5).Text = "本人辈字"
24 rt.Cells(0,6).Text = "名(曾用名)"
25 rt.Cells(0,7).Text = "出生年月日"
26 rt.Cells(0,8).Text = "出生时刻"
27 rt.Cells(0,9).Text = "卒于年月日时"
28 rt.Cells(0,10).Text = "葬于何地"
29 rt.Cells(0,11).Text = "坟墓朝向"
30 rt.Cells(0,12).Text = "历史重要事件记载"
31 rt.rows(0).Style.Borders.Top = New prt.LineDef(1,Color.LightGray)
32 rt.rows(0).Style.Borders.Bottom = New prt.LineDef(1,Color.LightGray)
33 With Tables("本人信息.配偶信息")
34 For r As Integer = 0 To .Rows.Count - 1 '遍历关联表每一行
35 rt.Cells(r+1,0).Text = .rows(r)("配偶姓名")
36 rt.Cells(r+1,1).Text = .rows(r)("娶于何地")
37 rt.Cells(r+1,2).Text = .rows(r)("父名")
38 rt.Cells(r+1,3).Text = .rows(r)("出生年月日时")
39 rt.Cells(r+1,4).Text = .rows(r)("卒于年月日时")
40 rt.Cells(r+1,5).Text = .rows(r)("生子几人")
41 rt.Cells(r+1,6).Text = .rows(r)("生女几人")
42 rt.Cells(r+1,7).Text = .rows(r)("原配(续配)")
43 Next
44 End With
45 doc.Body.Children.Add(rt)
46
47 With Tables("本人信息.配偶信息.儿子信息")
48 For r As Integer = 0 To .Rows.Count - 1 '遍历关联表每一行
49 rt.Cells(r+2,0).Text = .rows(r)("名字")
50 Next
51 End With
52 doc.Body.Children.Add(rt)
53
54 With Tables("本人信息.配偶信息.女儿信息")
55 For r As Integer = 0 To .Rows.Count - 1 '遍历关联表每一行
56 rt.Cells(r+3,0).Text = .rows(r)("名字")
57 rt.Cells(r+3,1).Text = .rows(r)("嫁何处")
58 rt.Cells(r+3,2).Text = .rows(r)("丈夫姓名")
59 Next
60 End With
61 doc.Body.Children.Add(rt)
62 doc.Preview
弹出:the added item already has the owner
[此贴子已经被作者于2014-5-4 16:09:15编辑过]