以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  想生成的表超80行后就另存表,重新引用  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=187048)

--  作者:zhuxinhui
--  发布时间:2023/6/17 11:13:00
--  想生成的表超80行后就另存表,重新引用

 Dim cm = e.form.Controls("ComboBox1").text    
            Dim App As New MSExcel.Application
            Dim Wb As MSExcel.Workbook = App.WorkBooks.Open(ProjectPath & "Attachments\\全电发票.xlsx")
            App.Visible = True
            Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets("明细模板")
            Dim r As Integer
            Dim m As Integer = 1
            Dim u As Table = Tables("销售开票明细")
            For i As Integer = 0 To u.Rows.count - 1
          If CInt(i / 150) <> i / 150 Then
                    Dim u1 As Row = u.Rows(i)
                    Ws.Range("A" & i + 4).Value = u1("开票品名")\'\'\'\'\'\'货物名称
                              
                    Ws.Range("H" & i + 4).Value = u1("税率")\'\'\'\'\'\'税率
         Else
               Wb.Save()
              Wb.SaveAs("D:\\" & cm & "123.xls")

          End If
            Next
            Wb.Save()

现在可以把数据生成后,全部引用到一个表,但是现在想:生成的表超80行后就另存表,重新引用


--  作者:zhuxinhui
--  发布时间:2023/6/17 11:14:00
--  
Dim cm = e.form.Controls("ComboBox1").text    
            Dim App As New MSExcel.Application
            Dim Wb As MSExcel.Workbook = App.WorkBooks.Open(ProjectPath & "Attachments\\全电fa piao.xlsx")
            App.Visible = True
            Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets("明细模板")
            Dim r As Integer
            Dim m As Integer = 1
            Dim u As Table = Tables("销售开piao明细")
            For i As Integer = 0 To u.Rows.count - 1      
                    Dim u1 As Row = u.Rows(i)
                    Ws.Range("A" & i + 4).Value = u1("开piao品名")\'\'\'\'\'\'货物名称                              
                    Ws.Range("H" & i + 4).Value = u1("税率")\'\'\'\'\'\'税率         
           Next
            Wb.Save()

现在可以把数据生成后,全部引用到一个表,但是现在想:生成的表超80行后就另存表,重新引用


--  作者:有点蓝
--  发布时间:2023/6/17 11:19:00
--  
全电fa piao.xlsx】已经有其它数据?还是空白的?

超80】是指execl文件里包含其它数据共80行?还是指Tables("销售开piao明细")每80行导出一个文件?

--  作者:zhuxinhui
--  发布时间:2023/6/17 11:23:00
--  
“销售开票明细”是使用分组进行生成了,现在是引用“销售开票明细”的数据到“明细模板”,每80行生成一个明细模板另存
--  作者:有点蓝
--  发布时间:2023/6/17 11:37:00
--  
看代码也没有其它什么复制的格式和处理,为什么不直接使用模板设置指定换页?http://www.foxtable.com/webhelp/topics/0203.htm

分组也可以指定换页行数:http://www.foxtable.com/webhelp/topics/1542.htm

--  作者:zhuxinhui
--  发布时间:2023/6/17 11:46:00
--  

这些都有考虑过,需要另存一份才行


--  作者:有点蓝
--  发布时间:2023/6/17 11:54:00
--  

            Dim App As New MSExcel.Application
dim cm  as integer =1
Dim u As Table = Tables("销售开piao明细")
For i As Integer = 0 To u.Rows.count - 1  step 80
            Dim Wb As MSExcel.Workbook = App.WorkBooks.Open(ProjectPath & "Attachments\\全电fa piao.xlsx")
            Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets("明细模板")
            Dim r As Integer
            Dim m As Integer = 1
for j as integer = 0 to 79
if  i+j < u.Rows.count - 1
                   Dim u1 As Row = u.Rows(i+j)
                    Ws.Range("A" & m + 4).Value = u1("开piao品名")\'\'\'\'\'\'货物名称                              
                    Ws.Range("H" & m + 4).Value = u1("税率")\'\'\'\'\'\'税率      
m += 1
end if   
next
Wb.SaveAs("D:\\" & cm & ".xls")
cm += 1
Wb.close
next
App.quit

--  作者:zhuxinhui
--  发布时间:2023/6/17 19:35:00
--  
老师真牛,我想了半天都想不到使用STEP
真服了