以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 生成模板文件 红色部分代码换成内部表【数据表】 怎么写呢? 也是同样要查找d1= '" & Product & "'符合条件的内容 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=170165) |
||||
-- 作者:cnsjroom -- 发布时间:2021/7/14 13:31:00 -- 生成模板文件 红色部分代码换成内部表【数据表】 怎么写呢? 也是同样要查找d1= '" & Product & "'符合条件的内容 生成模板文件 红色部分代码换成内部表【数据表】 怎么写呢? 也是同样要查找d1= \'" & Product & "\'符合条件的内容 麻烦老师看看 谢谢 当前代码如下: Dim Products As List(Of String) Products = DataTables("数据表").SQLGetValues("d1","","d1") For Each Product As String In Products \'output.show(Product) Dim Products1 As List(Of String) Products1 = DataTables("数据表").SQLGetValues("d9","d1=\'" & Product & "\'","d1") For Each Product1 As String In Products1 Dim t1 As String=Product1 Dim Values() As String Values = t1.split(".") Dim t2 As String=Values(0) output.show(t2) Dim Book As New XLS.Book(ProjectPath & "Attachments\\模板.xlsx") Dim fl As String = ProjectPath & "Reports\\" & t2 & "\\" & t2 & "-" & Product & ".xls" book.AddDataTable("数据表","wj","Sel ect * from {数据表} where d1= \'" & Product & "\' ") FileSys.CreateDirectory(ProjectPath & "Reports\\" & t2 & "\\") Book.Build() Book.Save(fl) Next Next
|
||||
-- 作者:有点蓝 -- 发布时间:2021/7/14 13:38:00 -- 参考:http://www.foxtable.com/webhelp/topics/0201.htm |
||||
-- 作者:cnsjroom -- 发布时间:2021/7/14 13:52:00 -- 回复:(有点蓝)参考:http://www.foxtable.com/webh... d1= \'" & Product & "\' 这个怎么定义过去呢?变量么? |
||||
-- 作者:有点蓝 -- 发布时间:2021/7/14 13:58:00 -- Sheet(行,列).Value = "<d1 = \'" & Product & "\'>" \'写入打印条件 |
||||
-- 作者:cnsjroom -- 发布时间:2021/7/17 10:42:00 -- 回复:(有点蓝)Sheet(行,列).Value = "&l... 老师 现在代码如下后 永远都只生成了第一条数据 所有的年度表都是只有一样的一条数据 附上模板文件 麻烦老师帮忙看看 我初步分析了一下 我是不是还应该加一个全选当前数据表 然后再进行文件生成? Dim Products As List(Of String) Products = DataTables("数据表").SQLGetValues("d1","","d1") For Each Product As String In Products \'output.show(Product) Dim Products1 As List(Of String) Products1 = DataTables("数据表").SQLGetValues("d9","d1=\'" & Product & "\'","d1") For Each Product1 As String In Products1 Dim t1 As String=Product1 Dim Values() As String Values = t1.split(".") Dim t2 As String=Values(0) output.show(t2) Dim Book As New XLS.Book(ProjectPath & "Attachments\\模板.xlsx") Dim Sheet As XLS.Sheet = Book.Sheets(0) Sheet(2,4).Value = "<d1 = \'" & Product & "\'>" \'写入打印条件 Dim fl As String = ProjectPath & "Reports\\" & t2 & "\\" & t2 & "-" & Product & ".xls" \'book.AddDataTable("数据表","wj","Se lect * from {数据表} where d1= \'" & Product & "\' ") FileSys.CreateDirectory(ProjectPath & "Reports\\" & t2 & "\\") Book.Build() Book.Save(fl) Next Next
|
||||
-- 作者:hongsejiyi -- 发布时间:2021/7/17 21:05:00 -- 应该先选中,需要通过模板生成文件的记录,再点通过模板生成。 [此贴子已经被作者于2021/7/17 21:04:58编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2021/7/18 20:22:00 -- h2单元格才是放条件的。认真看一下帮助 Sheet(1,7).Value = "<d1 = \'" & Product & "\'>"
|