Foxtable(狐表)用户栏目专家坐堂 → 专业报表能否放到窗口中浏览


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

主题:专业报表能否放到窗口中浏览

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


加好友 发短信
等级:五尾狐 帖子:1100 积分:8985 威望:0 精华:0 注册:2014/3/15 14:36:00
  发帖心情 Post By:2015/1/15 14:07:00 [显示全部帖子]

这样实现:

在窗口中添加图片浏览器,生成专业报表并在图片浏览器中显示,代码如下:

Dim pb As WinForm.PictureBox = e.Form.Controls("PictureBox1")
Dim  doc As  New  PrintDoc  '定义一个新报表
Dim rt As  New  prt.RenderTable '定义一个新表格
Dim ColNames As String() = New  String(){"客户","产品", "数量","单价","金额"}
Dim drs As  List(of DataRow) = DataTables("订单").Select("日期 = #" & Date.Today &  "#")
 For c As  Integer = 0 To ColNames.Length - 1 '逐列设置和填入内容
    rt.Cells(0,c).Text = ColNames(c) '列名作为标题
    For  r  As  Integer = 0 To drs.Count -1 '开始填入该列内容
        rt.Cells(r + 1, c).Text = drs(r)(ColNames(c))
     Next
 Next
 rt.Style.Gridlines.All = New prt.Linedef(Color.Gray)
doc.Body.Children.Add(rt)
doc.SaveImage("d:\Exporter\test.jpg")
pb.Image = GetImage("d:\Exporter\test_page1.jpg")

[此贴子已经被作者于2015-1-15 14:08:31编辑过]

 回到顶部