老师,不知道怎么回事,项目上传不了,下面是窗口按钮的代码:请老师帮忙看一下能不能解决上面的问题,谢谢!
Dim count As Integer = 47
Dim sfile As String = ProjectPath & "检验记录.xls"
Dim dfile As String = ProjectPath & "test.xls"
FileSys.CopyFile(sfile, dfile, True)
Dim book As new XLS.Book(dfile)
Dim sheet As XLS.Sheet = book.Sheets(0)
Dim nums1 As new List(Of String)
Dim nums2 As new List(Of String)
Dim nums3 As new List(Of String)
For Each dr As DataRow In DataTables("检验记录").Select("电容量_序号 is not null")
nums1.Add(dr("电容量_测试值"))
nums2.add(dr("损耗角正切_测试值"))
nums3.add(dr("漏电流_测试值"))
Next
For i As Integer = 1 To 30
If i > count Then Exit For
sheet(62+i, 2).value = nums1(Rand.Next(count))
sheet(62+i, 10).value = nums2(Rand.Next(count))
sheet(62+i, 18).value = nums3(Rand.Next(count))
Next
For i As Integer = 31 To 60
If i > count Then Exit For
sheet(32+i, 6).value = nums1(Rand.Next(count))
sheet(32+i, 14).value = nums2(Rand.Next(count))
sheet(32+i, 22).value = nums3(Rand.Next(count))
Next
For i As Integer = 61 To 90
If i > count Then Exit For
sheet(99+i, 2).value = nums1(Rand.Next(count))
sheet(99+i, 10).value = nums2(Rand.Next(count))
sheet(99+i, 18).value = nums3(Rand.Next(count))
Next
For i As Integer = 91 To 120
If i > count Then Exit For
sheet(62+i, 6).value = nums1(Rand.Next(count))
sheet(62+i, 14).value = nums2(Rand.Next(count))
sheet(62+i, 22).value = nums3(Rand.Next(count))
Next
book.save(dfile)
Dim proc As new Process
proc.File = dfile
proc.Start