Dim Ln1 As string = vbcrlf & vbcrlf
Dim doc As New PrintDoc '定义一个报表对象
Doc.PageSetting.LeftMargin = 0 '设置左边距
Doc.PageSetting.RightMargin=0
Doc.PageSetting.TopMargin = 0
Doc.PageSetting.BottomMargin = 0
Dim ra1,ra2,ra3,ra4 As New prt.RenderArea
Dim rm As New prt.RenderImage '定义一个图片对象
rm.Image = GetImage("ST21.JPG") '设置左侧图片
ra1.Width = 20 '宽度53毫米
ra1.Height = 300 '高度24毫米
ra1.Children.Add(rm)
doc.Body.Children.Add(ra1) '将图片对象加入报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
rm = New prt.RenderImage
rm.Image = GetImage("ST1.JPG") '设置页眉图片
ra2.Width = 188 '宽度53毫米
ra2.Height = 295 '高度24毫米
ra2.Style.Spacing.All = 5
ra2.Children.Add(rm)
Dim rt As New prt.RenderText '定义一个文本对象
rt.Text = Ln1 & "XXXX" '设置文本对象的内容
rt.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中
rt.Style.Font = New Font("Tahoma",20, FontStyle.Bold)
ra2.Children.Add(rt)
rt = New prt.RenderText
rt.Text = "ABC"
rt.Style.Font = New Font("Tahoma",11)
ra2.Children.Add(rt)
rt = New prt.RenderText
rt.Text =Ln1 & "XXXXXX"
rt.Style.Font = New Font("Tahoma",11, FontStyle.Bold)
ra2.Children.Add(rt)
Dim tb As New prt.RenderTable() '定义一个表格对象
ra2.Children.Add(tb) '将表格对象加入到报表中
tb.Style.GridLines.All = New prt.Linedef(Color.Gray)
tb.Width = 175 '表宽为150毫米
tb.Height = 20 '表高为150毫米
tb.Rows.Count = 2 '设置行数
tb.Cols.Count = 4 '设置列数
tb.Cols(0).Width = 35
tb.Cols(1).Width = 50
tb.Cols(2).Width = 30
tb.Cols(3).Width = 55
Dim Ls As String() = {"Accounts 賬目","From 由 To 至","Monthly 月租","Total 合計"}
For c As Integer = 0 To 3
rt= New prt.RenderText '定义一个文本对象
rt.Text = Ls(c) '为文本对象设置内容
rt.Style.Font = New Font("Tahoma",11, FontStyle.Bold)
tb.Cells(0, c).RenderObject = rt '将文本对象放置在单元格中
Next
tb.Rows(0).Style.TextAlignHorz = prt.AlignHorzEnum.Center '第一行内容水平居中
tb.Rows(0).Style.TextAlignVert = prt.AlignVertEnum.Center '第一行内容水平居中
Dim Ls3 As New List(of String)
Ls3.Add("Rental 租金")
Ls3.Add("01/12/2011-31/12/2011")
Ls3.Add("HK$888.00")
Ls3.Add("HK$888.00")
For c As Integer = 0 To 3
rt = New prt.RenderText '定义一个文本对象
rt.Text = Ls3(c) '为文本对象设置内容
rt.Style.Font = New Font("Tahoma",11)
tb.Cells(1, c).RenderObject = rt '将文本对象放置在单元格中
Next
tb.Rows(1).Style.TextAlignHorz = prt.AlignHorzEnum.Center '第一行内容水平居中
tb.Rows(1).Style.TextAlignVert = prt.AlignVertEnum.Center '第一行内容水平居中
rt = New prt.RenderText
rt.Text =Ln1 &"DEEDDSSS"
rt.Style.Font = New Font("Tahoma",11, FontStyle.Bold)
ra2.Children.Add(rt)
rt = New prt.RenderText
rt.Text =Ln1 & "DDDDDDDDEEEEEEE"
rt.Style.Font = New Font("Tahoma",11)
ra2.Children.Add(rt)
rt = New prt.RenderText
rt.Text =Ln1 & Ln1 & "敬註:" & Ln1 & "6 Month (5% off) Prepayment , 1 Year (10% off) Prepayment"
rt.Style.Font = New Font("Tahoma",12, FontStyle.Bold)
ra2.Children.Add(rt)
rt = New prt.RenderText
rt.Text =Ln1 & Ln1 & "DEEDDXXXXXXXXXXXX"
rt.Style.Font = New Font("Tahoma",11)
ra2.Children.Add(rt)
rt = New prt.RenderText
rt.Text ="ggggggggggggggggggggggggggggggg"
rt.x=2
rt.y=230
rt.Style.Font = New Font("標楷體",12, FontStyle.Bold)
ra2.Children.Add(rt)
rm = New prt.RenderImage
rm.Image = GetImage("STt.JPG") '设置图片
rm.x=2
rm.y =267
ra2.Children.Add(rm)
doc.Body.Children.Add(ra2)
'设置水印
rm = New prt.RenderImage
rm.Image = GetImage("222.BMP") '设置图片
rm.x = 50
rm.y =100
rm.Style.ImageAlign.StretchHorz = True '禁止图片水平拉伸
Doc.WaterMark = rm'
rt =New prt.RenderText
rt.Text =""
rt.BreakAfter = prt.BreakEnum.Page
rm = New prt.RenderImage
rm.Image = GetImage("ST21.JPG") '设置左侧图片
ra3.Width = 20 '宽度53毫米
ra3.Height = 300 '高度24毫米
ra3.Children.Add(rm)
doc.Body.Children.Add(ra3) '将图片对象加入报表
Doc.Preview() '预览
以上代码正常:图片ST21占据第2页左侧.
如我想于第2页再加入 页眉图片,代码如何?