以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  excel和word选定多行 结果只生成了第一行的数据?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=169635)

--  作者:cnsjroom
--  发布时间:2021/6/23 21:58:00
--  excel和word选定多行 结果只生成了第一行的数据?
excel选定多行 结果只生成了第一行的数据?麻烦老师帮忙看看
Dim rs As List(of Row) = Tables("党史教育学习台账").GetCheckedRows
Dim Book As New XLS.Book(ProjectPath & "Attachments\\台账.xls")
Dim fl As String = ProjectPath & "Reports\\台账.xls"
If rs.Count > 0 Then \'如果存在符合条件的行
    For Each r As Row In rs \'逐行生成报表
        Book.Build()
    Next
    Book.Save(fl)
End If
Dim Proc As New Process
Proc.File = fl
Proc.Start()

word选定多行 结果只生成了第一行的数据?
Dim rs As List(of Row) = Tables("党史教育学习台账").GetCheckedRows
Dim tm As String  = ProjectPath & "Attachments\\议程.doc"
Dim fl As String = ProjectPath & "Reports\\议程.doc"
If rs.Count > 0 Then \'如果存在符合条件的行
    Dim wrt As New WordReport(Tables("党史教育学习台账"),tm,fl) \'注意这里无需指定表名
    For Each r As Row In rs \'逐行生成报表
        wrt.BuildOne(r)
    Next
    wrt.Show() \'显示报表
End If
Dim Proc As New Process
Proc.File = fl
Proc.Start()

[此贴子已经被作者于2021/6/23 22:01:29编辑过]

--  作者:有点蓝
--  发布时间:2021/6/24 9:01:00
--  
1、excel模板不要指定条件
dim lst as New List(of string)
For Each r As Row In Tables("党史教育学习台账").GetCheckedRows
   lst.add(r("_Identify"))
Next
if lst.count = 0 then return
Tables("党史教育学习台账").filter = "_Identify in (" &string.join(",",lst.toarray)  & ")"

Dim Book As New XLS.Book(ProjectPath & "Attachments\\台账.xls")
Dim fl As String = ProjectPath & "Reports\\台账.xls"
    Book.Build()
    Book.Save(fl)
2、word用法我测试没有问题,是不是没有勾选行,具体请上传实例说明

--  作者:cnsjroom
--  发布时间:2021/6/24 9:57:00
--  回复:(有点蓝)1、excel模板不要指定条件dim lst as...

麻烦老师看看  还是没有得行

以下内容是专门发给有点蓝浏览

[此贴子已经被作者于2021/6/24 9:59:00编辑过]

--  作者:有点蓝
--  发布时间:2021/6/24 10:19:00
--  
没有开启复选框呀,怎么能用GetCheckedRows?http://www.foxtable.com/webhelp/topics/1776.htm