嗯嗯,是写入excel的时候有点问题了,行数必须累加
单击事件:
Dim Book As New XLS.Book '定义一个Excel工作簿
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
Sheet(0, 0).Value = "文件名"
vars("r") = 1
Dim FilePath As WinForm.TextBox = e.Form.Controls("TextBox1")
If FileSys.DirectoryExists(FilePath.Value) Then
Functions.Execute("文件名提取函数", FilePath.Text, Sheet)
End If
Book.Save("c:\reports\test.xls")
递归函数:
Dim path As String = args(0)
Dim Sheet As XLS.Sheet = args(1)
Dim r As Integer = vars("r")
For Each file As String In FileSys.GetFiles(path)
Dim Ifo As new FileInfo(file)
If Ifo.hidden=False Then
sheet(r,0).value = file
r += 1
End If
Next
vars(r) = r
For Each p As String In FileSys.GetDirectories(path)
Functions.Execute("文件名提取函数", p, Sheet)
Next