以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  打印的标题设置问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=30768)

--  作者:120931726
--  发布时间:2013/4/3 11:24:00
--  打印的标题设置问题


图片点击可在新窗口打开查看此主题相关图片如下:未命名.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.Bottom = 9
rx.Text = "采购单编号: " & Tables("采购单").Current("采购编号")
rx.Text = "供应商简称: " & Tables("采购单").Current("供应商简称")
rx.Text = "采购员: " & Tables("采购单").Current("采购员")
rx.Text = "采购日期: " & Tables("采购单").Current("采购日期")
rx.Text = "交货期: " & Tables("采购单").Current("交货期")
rx.Text = "交货日期: " & Tables("采购单").Current("交货日期")
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(0.3,Color.LightGray)
rt.CellStyle.Spacing.All = 1
rt.Cols.Count = 4
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(1,Color.LightGray)
rt.rows(0).Style.Borders.Bottom = New prt.LineDef(1,Color.LightGray)
With Tables("采购单.采购单明细表")   
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)("备注")          
\'If .rows(r)("中止") = True Then           
\'Dim rm As New prt.RenderImage           
\'rm.Image = getImage("Check.Ico")           
\'rm.Style.ImageAlign.AlignHorz = prt.ImageAlignHorzEnum.Center
\'rm.Style.ImageAlign.StretchHorz = False           
\'rm.Style.ImageAlign.StretchVert = False           
\'rt.Cells(r+1,5).RenderObject = rm       
\'End If   
Next
End With
doc.Body.Children.Add(rt)
rx = New prt.RenderText
rx.Style.FontBold = True
rx.Style.Spacing.Top = 3
rx.Text = "物料种类: " & Tables("采购单.采购单明细表").Rows.Count
rx.Style.TextAlignHorz = prt.AlignHorzEnum.Right
doc.Body.Children.Add(rx)
doc.Preview


--  作者:Bin
--  发布时间:2013/4/3 11:28:00
--  
rx.Text = "采购单编号: " & Tables("采购单").Current("采购编号")
rx.Text = "供应商简称: " & Tables("采购单").Current("供应商简称")
rx.Text = "采购员: " & Tables("采购单").Current("采购员")
rx.Text = "采购日期: " & Tables("采购单").Current("采购日期")
rx.Text = "交货期: " & Tables("采购单").Current("交货期")
rx.Text = "交货日期: " & Tables("采购单").Current("交货日期")

你这段代码只有最后一句起了作用. 上一段代码赋的值,被下一段代码覆盖了.
要么你 rx.Text =rx.Text & "交货日期: " & Tables("采购单").Current("交货日期")

要么你创建多个RenderText  逐一赋值 然后添加

--  作者:120931726
--  发布时间:2013/4/3 11:33:00
--  
用你说的第一种方法的话,怎么样才能使两个标题之间有间隔?
--  作者:Bin
--  发布时间:2013/4/3 11:34:00
--  
中间多拼接一段   "           "  你想要距离长度的空白