以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  实在是搞不懂?  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=59854)

--  作者:hbhb
--  发布时间:2014/11/12 12:14:00
--  实在是搞不懂?
甜大师:好!请教
为何按照您的方法修改后,还是出现示例的问题:导入测试2的excel表,按一下标题检查就出错?实在是搞不懂呀?????
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目29 (1).zip


--  作者:有点甜
--  发布时间:2014/11/12 14:09:00
--  

 excel有问题

 

\'\'\'


Dim p As WinForm.Panel = Forms("导入").Controls("Panel1")      \'---------表上面的覆盖面板
p.Visible = False

Dim a As WinForm.TextBox = Forms("导入").Controls("TextBox1")    \'---定义文件路径
Dim b As WinForm.ComboBox = Forms("导入").Controls("ComboBox1")  \'-----定义表-----
If a.Value = "" Or b.Value = "" Then
    MessageBox.Show("请选择工作簿及工作表","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Return Nothing
End If

Dim rgs As DataTable

Dim rg As WinForm.Table = Forms("导入").Controls("Table1")
rgs = rg.Table.DataTable

\'----------判断年初有无全部修改-------------------------------------------------------------


Dim shzs1() As String

shzs1 = new String()  {"年初"}
Dim rs3 As DataRow
Dim zbl As  Integer

Dim maxcol As Integer = 100

For Each shz1 As String In shzs1
    For Each cl1 As Col In rg.Table.Cols
       
        If cl1.Index >= maxcol Then Exit For
        rs3 = rgs.find(cl1.name & " Like \'" & shz1 & "*\'")
       
        If rs3 IsNot Nothing Then
           
            If rs3(cl1.name) Like "*" & shz1 & "*"  Then
               
                zbl = zbl +1
            End If
        End If
    Next
   
    If  zbl = 2  Then
        Exit For
    Else
        MessageBox.Show("表的标题年初数、期末数,资产与负债及所有者权益不一致!" & vbcrlf & "请资产类和负债及所有者权益类同步修改!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        Return Nothing
    End If
   
Next

 


\'----------判断期末有无全部修改---------------


Dim shzs2() As String
shzs2 = new String()  {"期末"}
Dim rs2 As DataRow
Dim zbl2 As  Integer
For Each shz2 As String In shzs2
    For Each cl2 As Col In rg.Table.Cols
       
        If cl2.Index >= maxcol Then Exit For
        rs2 = rgs.find(cl2.name & " Like \'" & shz2 & "*\'")
       
        If rs2 IsNot Nothing Then
           
            If rs2(cl2.name) Like "*" & shz2 & "*"  Then
               
                zbl2 = zbl2 +1
            End If
        End If
    Next
   
    If  zbl2 = 2  Then
        Exit For
    Else
        MessageBox.Show("表的标题年初数、期末数,资产与负债及所有者权益不一致!" & vbcrlf & "请资产类和负债及所有者权益类同步修改!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        Return Nothing
    End If
   
Next


If zbl = 2 And zbl2 = 2   Then
   
    MessageBox.Show("检查完毕,未发现问题!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
   
End If


--  作者:hbhb
--  发布时间:2014/11/12 14:28:00
--  
excel能打开呀?

这样能导入吗?还是提示excel有问题?
--  作者:有点甜
--  发布时间:2014/11/12 14:49:00
--  
 测试没有问题啊,特殊问题要特殊处理啊
--  作者:hbhb
--  发布时间:2014/11/12 14:55:00
--  
是不是excel老版本最多256列的原因?
--  作者:有点甜
--  发布时间:2014/11/12 15:08:00
--  
以下是引用hbhb在2014-11-12 14:55:00的发言:
是不是excel老版本最多256列的原因?

 

不知道,反正要特殊处理,用我给你的代码啊


--  作者:hbhb
--  发布时间:2014/11/12 15:20:00
--  
谢谢!知道了!