以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 数据导入尾部空值 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=186001) |
-- 作者:可乐七号 -- 发布时间:2023/3/30 19:05:00 -- 数据导入尾部空值 在数据导入时,数据部分后面的空行也会全部导入了,这个怎么判断处理? |
-- 作者:有点蓝 -- 发布时间:2023/3/31 8:43:00 -- 怎么做的导入? |
-- 作者:可乐七号 -- 发布时间:2023/3/31 10:24:00 -- e.Form.Controls("SINumber").text=format(Date.Now, "yyyyMMddHHmmss") If e.Form.Controls("workdate").text = "" Then MessageBox.Show("作业日期不能为空!","提示") Return End If If e.Form.Controls("filename").text = "" Then MessageBox.Show("导入文件不能为空!","提示") Return End If Dim Book As New XLS.Book(e.Form.Controls("filename").Value) Dim Sheet As XLS.Sheet=Book.Sheets(0) Tables("inputWorkRecord").StopRedraw() \'Dim nms() As String={"groupName","personName","post","method","workGroupName","projectName","billingMethod","workName","workingHours","yield","season"} For n As Integer =1 To Sheet.Rows.Count-1 Dim r As Row = Tables("inputWorkRecord").AddNew() If Sheet(n,1).Value.trim() <>"" And Sheet(n,1).Value IsNot Nothing Then r("SINumber") =e.Form.Controls("SINumber").text r("workdate") =e.Form.Controls("workdate").text r("groupName") =Sheet(n,1).Value.trim() r("personName") =Sheet(n,2).Value.trim() r("post") =Sheet(n,3).Value.trim() r("method") =Sheet(n,4).Value.trim() r("workGroupName") =Sheet(n,5).Value.trim() r("projectName") =Sheet(n,6).Value.trim() r("billingMethod") =Sheet(n,7).Value.trim() r("workName") =Sheet(n,8).Value.trim() r("workingHours") =Sheet(n,9).Value.trim() r("yield") =Sheet(n,10).Value.trim() r("season") =Sheet(n,11).Value.trim() End If Next Tables("inputWorkRecord").ResumeRedraw() DataTables("inputWorkRecord").Save e.Form.Controls("filename").text="" |
-- 作者:有点蓝 -- 发布时间:2023/3/31 10:30:00 -- 可能第一个不是空值,有其它看不见的数据,到命令窗口执行调试看看 For n As Integer =1 To Sheet.Rows.Count-1 Dim r As Row = Tables("inputWorkRecord").AddNew() If Sheet(n,1).Value.trim() <>"" And Sheet(n,1).Value IsNot Nothing Then |