以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]多表excel 报表 出错-表单属于其他工作簿  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=131553)

--  作者:方丈
--  发布时间:2019/3/1 10:25:00
--  [求助]多表excel 报表 出错-表单属于其他工作簿
多表excel 报表 出错-表单属于其他工作簿
Dim CPMS As List(OF String) = DataTables("订单").GetValues("产品","[产品] is not null")
Dim F1 As String = ProjectPath & "Reports\\订单打印.xls"
For Each CPM As String In CPMS
Dim k As Integer = 1
Dim Book1 As New XLS.Book(ProjectPath & "Attachments\\订单.xls")
Dim Book2 As New XLS.Book(ProjectPath & "Attachments\\订单模板.xls")
Dim Sheet = Book1.Sheets(0)
sheet.name = CPM
Book2.Sheets.Add(Sheet)
\'Book2.Sheets.insert(k,Sheet)
Book2.Save(ProjectPath & "Attachments\\订单模板.xls")    
Dim Book3 As New XLS.Book(ProjectPath & "Attachments\\订单模板.xls") \'打开模板
Dim sh2 As XLS.Sheet = Book3.Sheets(k)
   sh2(3,9).Value =" < [产品] = \'" & cpm & "\' > "     \'修改模板,加入筛选条件
k=k+1
Next
Dim Book4 As New XLS.Book(ProjectPath & "Attachments\\订单模板.xls") \'打开模板
Book4.Build() \'生成细节区
Book4.Save(F1) \'保存工作簿
Dim Proc As New Process \'打开工作簿
Proc.File = F1
Proc.Start()




[此贴子已经被作者于2019/3/1 12:16:32编辑过]

--  作者:有点甜
--  发布时间:2019/3/1 10:27:00
--  

要先remove,才能add

 

http://www.foxtable.com/webhelp/scr/1465.htm