Dim n1 As Integer = 0
Dim t As Table = Tables("工资摘要")
Dim f1 As String = ("工资表.xls")
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim nd As WinForm.TreeNode = trv.SelectedNode
Dim App As New MSExcel.Application
Dim wb As MSExcel.WorkBook = App.WorkBooks.open(ProjectPath & f1)
Dim ws1 As MSExcel.WorkSheet = wb.WorkSheets("工资")
For n As Integer = 2 To t.Cols.count-1
ws1.cells(2+n,2).value = t.Cols(n).Name
Next
For i As Integer = t.Position To t.Rows.Count - 1
If nd.Nodes(i).Checked = True Then '如果当前节点已勾选
Dim fdr As DataRow = t.DataTable.find("代码 like '" & t.Rows(i)("代码") & ".%'")
If fdr Is Nothing Then
ws1.cells(3,3+n1).Value = t.Rows(i)("摘要")
For nn As Integer = 2 To t.Cols.count-1
ws1.cells(2+nn,3+n1).value = t.rows(i)(t.Cols(nn).Name)
Next
n1 = n1 + 1
End If
End If
Next
ws1.UsedRange.Formula = ws1.UsedRange.Formula
ws1.Activate
app.ActiveWindow.DisplayZeros = False
wb.save
wb.close
App.Quit
Dim Proc As New Process
Proc.File = (f1)
Proc.Start()
老师,为什么代码 If nd.Nodes(i).Checked = True Then '如果当前节点已勾选,不能生效?