If FileSys.FileExists("c:\reports\test.xls") Then
FileSys.DeleteFile("c:\reports\test.xls")
End If
Dim tbl As Table =Tables(Forms("窗口1").name & "_table1")
Dim hdr As Integer = tbl.HeaderRows '获得表头的层数
Dim cnt,cnt2 As Integer
Dim Book As New XLS.Book
Dim Sheet As XLS.Sheet = Book.Sheets(0)
tbl.CreateSheetHeader(Sheet) '生成表头
For c As Integer = 0 To tbl.Cols.Count() - 1
If tbl.Cols(c).Visible Then
For r As Integer = 0 To tbl.Rows.Count(True) - 1
sheet(r + hdr,cnt).value = tbl(r,c,True)
Next
cnt = cnt + 1
End If
Next
Book.Save("c:\reports\test.xls")
cnt = 0
For r0 As Integer = 1 To tbl.Rows.Count(True)
cnt = r0 -cnt2
output.show(r0 & " = cnt: " & cnt & " " & cnt2 & " " & sheet(cnt,0).value)
If right(sheet(cnt,0).value,2) <> "小计" Then
Sheet.Rows.RemoveAt(cnt)
cnt2 = cnt2 + 1
Else
End If
Next
Book.Save("c:\reports\test2.xls")
Dim Proc As New Process
Proc.File = "c:\reports\test2.xls"
Proc.Start()