Foxtable(狐表)用户栏目专家坐堂 → Excel表中布尔型值如何拷贝到Foxtable表的对应列中?


  共有7499人关注过本帖树形打印复制链接

主题:Excel表中布尔型值如何拷贝到Foxtable表的对应列中?

帅哥哟,离线,有人找我吗?
狐狸爸爸
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/4/7 8:54:00 [显示全部帖子]

Dim dlg As New OpenFileDialog '定义一个新的OpenFileDialog
dlg.Filter= "Excel文件|*.xls" '设置筛选器
If dlg.ShowDialog = DialogResult.Ok Then '如果用户单击了确定按钮
    Dim Book As New XLS.Book(dlg.FileName)
    Dim Sheet As XLS.Sheet = Book.Sheets(0)
    Dim nms() As String = {"销售金额","税额","应收款金额","出库类别"}
    Tables("表A").AddNew(Sheet.Rows.Count -1)
    For m As Integer = 0 To nms.Length - 1
        For n As Integer = 1 To Sheet.Rows.Count -1
            Dim r As Row = Tables("表A").Rows(n-1)
            If m = 3  Then
                If Sheet(n,m).Text = "True" OrElse Sheet(n,m).Text = "1"
                    r(nms(m)) = True
                Else
                    r(nms(m)) = False
                End If
            Else
                r(nms(m)) = Sheet(n,m).Value
            End If
        Next
    Next
End If

 回到顶部