以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- StateFilter (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=129254) |
-- 作者:huhu -- 发布时间:2018/12/25 12:19:00 -- StateFilter StateFilter 状态筛选,StateFilterEnum型枚举,可选值有: Default: 显示所有行 例如在当前表显示新增行: CurrentTable.StateFilter = StateFilterEnum.Added 导入代码如下。就是希望只把新增行加载出来。 Dim App As New MSExcel.Application try If Forms("正在导入").Opened = False Then Forms("正在导入").open End If Dim Wb As MSExcel.Workbook = App.WorkBooks.Open("D:\\物料编码.XLS") Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1) Tables("物料编码").StopRedraw() \'注意以下数组中列名称的顺序,必须和Excel表中的列顺序一致 Dim ra = ws.UsedRange Dim nms() As String = {"物料编码","物料名称","原型物料编码","原型物料名称"} \'注意下面的循环变量从1开始,而不是从0开始,因为Excel表的第一行是标题 For n As Integer = 2 To ra.Rows.Count Dim wlbm As String = ws.cells(n,1).Text If DataTables("物料编码").SQLFind("物料编码 = \'" & wlbm & "\'") Is Nothing Then \'如果不存在同编号的计划表 Dim r As Row = Tables("物料编码").AddNew() For m As Integer = 0 To nms.Length - 1 r(nms(m)) = ws.cells(n,m+1).Value r.save Next End If Next Tables("物料编码").ResumeRedraw() \'DataTables("物料编码").LoadFilter = "" \'DataTables("物料编码").Load Tables("物料编码").StateFilter = StateFilterEnum.Added If Forms("正在导入").Opened = True Then Forms("正在导入").close MessageBox.show("物料编码导入完成","导入完成",MessageBoxButtons.OK,MessageBoxIcon.Information) End If catch ex As exception finally app.quit End try |
-- 作者:有点甜 -- 发布时间:2018/12/25 12:56:00 -- 删除这句代码 r.save
|