左栏'); } else{ document.write('关闭左栏'); } }catch(e){alert(e);}
Foxtable(狐表)用户栏目专家坐堂 → 生成报表的图表问题


  共有3974人关注过本帖树形打印复制链接

主题:生成报表的图表问题

帅哥哟,离线,有人找我吗?
zaldq
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:26 积分:361 威望:0 精华:0 注册:2013/10/12 8:26:00
生成报表的图表问题  发帖心情 Post By:2013/11/28 22:30:00 [只看该作者]

将一个表的内容生成报表如员工资料卡一样的报表时如果将另一个表的照片根据姓名字段把照片拿来这个报表使用,简单说就是资料和相片不在同一个表里,只是用姓名将两表建立关联而以,现在在生成一个员工资料卡,不知道怎么把照片拿出来放在资料卡里。

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2013/11/28 22:44:00 [只看该作者]

 既然建立了关联,就可以用打印关联表的方式取出。

 先自己看一下


 回到顶部
帅哥哟,离线,有人找我吗?
zaldq
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:26 积分:361 威望:0 精华:0 注册:2013/10/12 8:26:00
  发帖心情 Post By:2013/11/28 23:49:00 [只看该作者]

我做的是专业报表的不是execl报表,好像不一样

 回到顶部
帅哥哟,离线,有人找我吗?
Bin
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2013/11/29 8:30:00 [只看该作者]


 回到顶部
帅哥哟,离线,有人找我吗?
zaldq
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:26 积分:361 威望:0 精华:0 注册:2013/10/12 8:26:00
  发帖心情 Post By:2013/11/29 10:21:00 [只看该作者]

单个打印的时候可以了,现在就连续打印的代码不知道,有改了一个代码,每个都打印第一张照片,就是第二个NEXT要放在哪里才会使照片也随着变

 回到顶部
帅哥哟,离线,有人找我吗?
Bin
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2013/11/29 10:23:00 [只看该作者]

把你代码发出来,既然你连续打印懂得变动其他的值,图片也是同理的,怎么会不懂.

 回到顶部
帅哥哟,离线,有人找我吗?
zaldq
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:26 积分:361 威望:0 精华:0 注册:2013/10/12 8:26:00
  发帖心情 Post By:2013/11/29 10:38:00 [只看该作者]

Dim Filter As String
With e.Form.Controls("xqmc2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = "小区名称= '" & .Value & "'"
    End If
End With
With e.Form.Controls("dh2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "幢号 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("fzgx2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "与户主关系 = '" & .Value & "'"
    End If
End With
With e.Form.Controls("sfyf2")
    If .Value IsNot Nothing Then
        If Filter > "" Then
            Filter = Filter & " And "
        End If
        Filter = Filter & "是否育妇 = '" & .Value & "'"
    End If
End With
If Filter > "" Then
    Tables("居民信息表").Filter = Filter
End If

With Tables("居民信息表")
     .Select(0,0, .Rows.Count -1, .Cols.Count -1)
End With

Dim xqmc2 As WinForm.ComboBox = e.Form.Controls("xqmc2")
Dim dh2 As WinForm.TextBox = e.Form.Controls("dh2")
Dim fzgx2 As WinForm.ComboBox = e.Form.Controls("fzgx2")
Dim sfyf2 As WinForm.ComboBox = e.Form.Controls("sfyf2")
xqmc2.Text = ""
dh2.Text = ""
fzgx2.Text = ""
sfyf2.Text = ""

Dim doc As New PrintDoc '定义一个报表
Dim tbl As Table = Tables("居民信息表")
Dim tb2 As Table = Tables("居民信息表.相片")
For i As Integer = tbl.TopRow To tbl.BottomRow
For s As Integer = tb2.TopRow To tb2.BottomRow
    Dim rw As Row = tbl.Rows(i)
    Dim rh As Row = tb2.Rows(s)
    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 = 18 '大体大小为16磅
    rx.Style.TextAlignHorz = prt.AlignHorzEnum.Center '水平居中排列
    rx.Style.Spacing.Bottom = 3 '和下面的对象(表格)距离3毫米
    ra.Children.Add(rx) '加入到容器中
    '指定行数?列数?列宽?行高
rt.Rows.Count = 11 '设置总行数
rt.Cols.Count = 7 '设置总列数
rt.Height = 127 '设置表格的高度为80毫米
rt.Rows(10).Height = 30 '设置第7行(显示备注的行)的高度为40毫米,剩余高度被平均分排到其他行
rt.Cols(0).Width = 18 '设置前9列的宽度,剩余的宽度被分配给10列(显示图片的那列)
rt.Cols(1).Width = 24
rt.Cols(2).Width = 18
rt.Cols(3).Width = 24
rt.Cols(4).Width = 18
rt.Cols(5).Width = 18
'设置合并单元格
rt.Cells(0,6).SpanRows = 5 '第1行第7个单元格向下合并5行(用于显示照片)
rt.Cells(5,5).SpanCols = 2 '第5行第6个单元格向右合并2列(用于显示联系电话)
rt.Cells(6,5).SpanCols = 2 '第6行第6个单元格向右合并2列(用于显示配偶身份证号)
rt.Cells(7,5).SpanCols = 2 '第6行第6个单元格向右合并2列(用于显示身份证号)
rt.Cells(8,3).SpanCols = 2 '第6行第6个单元格向右合并2列(用于显示管理单位)
rt.Cells(9,1).SpanCols = 2 '第6行第6个单元格向右合并2列(用于显示管理单位)
rt.Cells(9,3).SpanCols = 2 '第6行第6个单元格向右合并2列(用于显示管理单位)
rt.Cells(9,5).SpanCols = 2 '第6行第6个单元格向右合并2列(用于显示管理单位)
rt.Cells(10,0).SpanCols = 7 '第10行第1个单元格向右合并7列(用于显示备注)
'设置表格样式
  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(9).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(0,4).Text= "幢号"
rt.Cells(0,5).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(1,4).Text= "姓名"
rt.Cells(1,5).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(2,4).Text= "未孩性别"
rt.Cells(2,5).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(3,4).Text= "婚姻状况"
rt.Cells(3,5).Text = rw("婚姻状况")
rt.Cells(4,0).Text= "现有子女"
rt.Cells(4,1).Text = rw("现有子女")
rt.Cells(4,2).Text= "男孩"
rt.Cells(4,3).Text = rw("男孩")
rt.Cells(4,4).Text= "女孩"
rt.Cells(4,5).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(5,4).Text= "联系电话"
rt.Cells(5,5).Text = rw("联系电话")
rt.Cells(6,0).Text= "配偶姓名"
rt.Cells(6,1).Text = rw("配偶姓名")
rt.Cells(6,2).Text= "配偶出生日期"
rt.Cells(6,3).Text = rw("配偶出生日期")
rt.Cells(6,4).Text= "配偶身份证号"
rt.Cells(6,5).Text = rw("配偶身份证号")
rt.Cells(7,0).Text= "配偶户口性质"
rt.Cells(7,1).Text = rw("配偶户口性质")
rt.Cells(7,2).Text= "未孩出生日期"
rt.Cells(7,3).Text = rw("未孩出生日期")
rt.Cells(7,4).Text= "身份证号"
rt.Cells(7,5).Text = rw("身份证号")
rt.Cells(8,0).Text= "管理区域"
rt.Cells(8,1).Text = rw("管理区域")
rt.Cells(8,2).Text= "管理单位"
rt.Cells(8,3).Text = rw("管理单位")
rt.Cells(8,5).Text= "是否育妇"
rt.Cells(8,6).Text = rw("是否育妇")
rt.Cells(9,0).Text= "全员村居"
rt.Cells(9,1).Text = rw("全员村居")
rt.Cells(9,3).Text= "全员家庭编号"
rt.Cells(9,5).Text = rw("全员家庭编号")
rt.Cells(10,0).Text = rw("备注")
rt.Cells(0,6).Image = GetImage(rh("相片"))
 ra.Children.Add(rt) '加入到容器中
 Doc.Body.ChildRen.Add(ra) '将容器加入到报表中
 Next
 Next
Doc.Preview() '预览报表

 回到顶部
帅哥哟,离线,有人找我吗?
Bin
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2013/11/29 10:45:00 [只看该作者]

你好,根据你的代码.你RH应该是每次循环都是不同的行,是没道理是相同的图片的.

如果是相同的图片,请你检查行的图片路径是否有问题,再到对应路径检查对应图片是否有问题.

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47448 积分:251048 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/11/29 11:15:00 [只看该作者]

前面都是rw,到图片变成rh,会不会是这个原因:

 

rt.Cells(10,0).Text = rw("备注")
rt.Cells(0,6).Image = GetImage(rh("相片"))


 回到顶部
帅哥哟,离线,有人找我吗?
Bin
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2013/11/29 11:16:00 [只看该作者]

RH是第二层循环,循环另外一个表,按道理也不会出问题才对呀.

 回到顶部
总数 20 1 2 下一页