Foxtable(狐表)用户栏目专家坐堂 → 如何将临时表直接作为报表输出数据源?


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

主题:如何将临时表直接作为报表输出数据源?

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


加好友 发短信
等级:一尾狐 帖子:431 积分:4325 威望:0 精华:0 注册:2017/3/20 21:08:00
如何将临时表直接作为报表输出数据源?  发帖心情 Post By:2020/3/31 9:30:00 [显示全部帖子]

If Tables(e.Form.name & "_table1").Rows.Count>0 Then
Dim t1 As Table
t1.DataSource = DataT ables(e.Form.name & "_table1")     我这样做了
Dim i1 As Integer
    Dim Book As New XLS.Book(ProjectPath & "Attachments\proc99_all.xls") '9_report.xls")
    Dim sheet As XLS.Sheet = Book.Sheets(0)
    Dim Style As Xls.Style=book.NewStyle
    Style.BackColor=Color.Red
    ExcelPath="D:\step00\"
    Dim fl As String = ExcelPath & "ExcelReport\proc99_all.xls" 
     book.Add DataTable("proc99_pub","","sel ect * fro m {t1} order by p9.proc01,p9.proc02,p9.proc03,p8.proc805" )    ‘这里报错了。
    book.Build()
    book.save( fl ) 'fl
    Dim proc As New Process
    Proc.file=fl
    proc.Start()
End If
请教:如何正确将当前:Tables(e.Form.name & "_table1") 的记录直接作为  book.AddDataTable 的数据源 ?
谢谢专家!


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


加好友 发短信
等级:一尾狐 帖子:431 积分:4325 威望:0 精华:0 注册:2017/3/20 21:08:00
临时表直接打印再请教  发帖心情 Post By:2020/3/31 11:20:00 [显示全部帖子]


图片点击可在新窗口打开查看此主题相关图片如下:error1.png
图片点击可在新窗口打开查看


If Tables(e.Form.name & "_table1").Rows.Count>0 Then
    Dim t1 As Table
    t1.DataSource = DataT ables(e.Form.name & "_table1")
    Dim i1 As Integer
    Dim Book As New XLS.Book(Projec tPath & "Attachments\proc99_all.xls") '9_report.xls")
    Dim sheet As XLS.Sheet = Book.Sheets(0)
    Dim Style As Xls.Style=book.NewStyle
    Style.BackColor=Color.Red
    ExcelPath="D:\step00\"
    Dim fl As String = ExcelPath & "ExcelReport\proc99_all.xls"
    Sheet(7,0).Value = "<proc99_from_view_all_Table1>"  '写入表名
    book.Build()
    book.save( fl ) 'fl
    Dim proc As New Process
    Proc.file=fl
    proc.Start()
End If

我用以上方法测试,系统报错为:未将实列引用到对象
请再我看看,语句上什么地主有错?
谢谢!


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


加好友 发短信
等级:一尾狐 帖子:431 积分:4325 威望:0 精华:0 注册:2017/3/20 21:08:00
再请教:我的报表只打出来1行记录,  发帖心情 Post By:2020/3/31 11:59:00 [显示全部帖子]

修改后:
再请教:我的报表只打出来1行记录,
我应该再修改什么地方?
If Tables(e.Form.name & "_table1").Rows.Count>0 Then
    Dim i1 As Integer
    Dim Book As New XLS.Book(ProjectPath & "Attachments\proc99_all.xls") '9_report.xls")
    Dim sheet As XLS.Sheet = Book.Sheets(0)
    Dim Style As Xls.Style=book.NewStyle
    Style.BackColor=Color.Red
    ExcelPath="D:\step00\"
    Dim fl As String = ExcelPath & "ExcelReport\proc99_all.xls"
    Sheet(7,0).Value = "<proc99_from_view_all_Table1>"  '写入表名
    book.Build()
    book.save( fl ) 'fl
    Dim proc As New Process
    Proc.file=fl
    proc.Start()
End If


 回到顶部