以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]帮助文档里面的连续打印资料卡  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=172885)

--  作者:bigeng
--  发布时间:2021/11/5 15:29:00
--  [求助]帮助文档里面的连续打印资料卡
帮助文档里面的连续打印资料卡,我直接复制的源代码,但是命令窗口显示还是一张员工资料卡
--  作者:bigeng
--  发布时间:2021/11/5 15:30:00
--  
直接复制的代码:
Dim doc As New PrintDoc \'定义一个报表
Dim
 tbl As Table = Tables("员工")
For
 i as Integer = tbl.TopRow To tbl.BottomRow
    Dim
 rw As Row = tbl.Rows(i)
    Dim
 rt As New prt.RenderTable() \'定义一个表格对象
    
Dim rx As New prt.RenderText \'定义一个文本对象
    
Dim ra As New prt.RenderArea \'定义一个容器
    
ra.SplitVertBehavior = prt.SplitBehaviorEnum.Never  \'禁止容器因为分页而被垂直分割
    \'加入标题

    rx.text = 
"员工资料卡"
    rx.Style.FontBold = 
True \'字体加粗
    rx.Style.FontSize = 
16 \'大体大小为16磅
    rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center 
\'水平居中排列
    rx.Style.Spacing.Bottom = 
3 \'和下面的对象(表格)距离3毫米
    ra.Children.Add(rx) 
\'加入到容器中
    \'指定行数、列数、列宽、行高

    rt.Rows.Count = 
7 \'设置总行数
    rt.Cols.Count = 
5 \'设置总列数
    rt.Height = 
75 \'设置表格的高度
    rt.Rows(
6).Height = 30 \'设置第7行(显示备注的行)的高度,剩余高度被平均分排到其他行
    rt.Cols(
0).Width = 26 \'设置前四列的宽度,剩余的宽度被分配给5列(显示图片的那列)
    rt.Cols(
1).Width = 35
    rt.Cols(
2).Width = 26
    rt.Cols(
3).Width = 40
    
\'设置合并单元格
    rt.Cells(
0,4).SpanRows = 6 \'第1行第5个单元格向下合并6行(用于显示照片)
    rt.Cells(
4,1).SpanCols = 3 \'第5行第2个单元格向右合并3列(用于显示地址)
    rt.Cells(
6,0).SpanCols = 5 \'第7行第1个单元格向右合并5列(用于显示备注)
    \'设置表格样式

    rt.CellStyle.Spacing.All = 
1 \'单元格内容缩进1毫米
    rt.Style.Spacing.Bottom = 
5 \'和下一个资料卡的距离是5毫米
    rt.Style.GridLines.All = New prt.Linedef 
\'设置网格线
    rt.Style.TextAlignVert = prt.AlignVertEnum.Center 
\'内容垂直居中
    rt.Rows(
6).Style.TextAlignVert = prt.AlignVertEnum.Top \'唯独第7行是备注,内容靠上对齐
    \'下面很简单,指定每一个单元格的内容

    rt.Cells(
0,0).Text= "姓名"
    rt.Cells(
0,1).Text = rw("姓名")
    rt.Cells(
0,2).Text= "出生日期"
    rt.Cells(
0,3).Text = rw("出生日期")
    rt.Cells(
1,0).Text= "部门"
    rt.Cells(
1,1).Text = rw("部门")
    rt.Cells(
1,2).Text= "雇佣日期"
    rt.Cells(
1,3).Text = rw("雇佣日期")
    rt.Cells(
2,0).Text= "性别"
    rt.Cells(
2,1).Text = rw("性别")
    rt.Cells(
2,2).Text= "职务"
    rt.Cells(
2,3).Text = rw("职务")
    rt.Cells(
3,0).Text= "城市"
    rt.Cells(
3,1).Text = rw("城市")
    rt.Cells(
3,2).Text= "邮政编码"
    rt.Cells(
3,3).Text = rw("邮政编码")
    rt.Cells(
4,0).Text= "地址"
    rt.Cells(
4,1).Text = rw("地址")
    rt.Cells(
5,0).Text= "家庭电话"
    rt.Cells(
5,1).Text = rw("家庭电话")
    rt.Cells(
5,2).Text= "办公电话"
    rt.Cells(
5,3).Text = rw("办公电话")
    rt.Cells(
6,0).Text = rw("备注")
    rt.Cells(
0,4).Image = GetImage(rw("照片"))
    ra.Children.Add(rt) 
\'加入到容器中
    Doc.Body.ChildRen.Add(ra) 
\'将容器加入到报表中
Next

Doc.Preview() 
\'预览报表

--  作者:有点蓝
--  发布时间:2021/11/5 15:56:00
--  
只选中了一行吧:http://www.foxtable.com/webhelp/topics/0447.htm
--  作者:bigeng
--  发布时间:2021/11/5 16:16:00
--  
是的,没有注意。选中以后就可以了,谢谢蓝版!