老师帮我看看这段代码执行到最后就是保存的时候出现“指定的转换无效”的提示,不知道哪里出了问题,刚刚调试的时候是正常的,突然就出现这个问题了。
Dim wjm As WinForm.TextBox = e.Form.Controls("三级")
Dim fl As String = ProjectPath & "Reports\混凝土强度试验台帐\" & wjm.Value & ".xls"
Dim dt As Table = Tables("混凝土试验报告台帐_台帐")
Dim Book As new XLS.Book(ProjectPath & "Attachments\砼评定.xls") '打开模板
Dim Sheet As XLS.Sheet = Book.Sheets(0) '引用工作簿的第一个工作表
MessageBox.Show(1)
Dim v As Integer = Tables("混凝土试验报告台帐_台帐").Cols("强度代表值").Index
MessageBox.Show(2)
For r As Integer = 0 To dt.Rows.Count - 1 '填入数据
'For c As Integer = 0 To dt.Cols.Count -1
Select Case r
Case 0 To 19
Sheet(0+7,r+0).Value = dt.rows(r)(v)
Case 20 To 39
Sheet(1+7,r-20).Value = dt.rows(r)(v)
Case 40 To 59
Sheet(2+7,r-40).Value = dt.rows(r)(v)
Case 60 To 79
Sheet(3+7,r-60).Value = dt.rows(r)(v)
Case 80 To 99
Sheet(4+7,r-80).Value = dt.rows(r)(v)
Case 100 To 119
Sheet(5+7,r-100).Value = dt.rows(r)(v)
Case 120 To 139
Sheet(6+7,r-120).Value = dt.rows(r)(v)
Case 140 To 159
Sheet(7+7,r-140).Value = dt.rows(r)(v)
Case 160 To 179
Sheet(8+7,r-160).Value = dt.rows(r)(v)
Case 180 To 199
Sheet(9+7,r-180).Value = dt.rows(r)(v)
Case 200 To 219
Sheet(10+7,r-200).Value = dt.rows(r)(v)
Case 220 To 239
Sheet(11+7,r-220).Value = dt.rows(r)(v)
End Select
Next
MessageBox.Show(5)
Book.Save(fl)
此主题相关图片如下:云之家图片20180115211043.png