以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- TEXT函数 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=153629) |
||||
-- 作者:fendouww -- 发布时间:2020/8/17 23:35:00 -- TEXT函数 可以在狐表写入TEXT函数直接转换值吗?表格是时间格式,我 以下报错 |
||||
-- 作者:有点蓝 -- 发布时间:2020/8/18 8:44:00 -- 如果要导入数据,参考:http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=65686&skin=0 |
||||
-- 作者:fendouww -- 发布时间:2020/8/18 9:45:00 -- 导入代码没有问题,是导入后不是时间格式,变成了日期格式? ![]() ![]() If sheet(n,dict("到货时间")).Text > "" Then .rows(i)("到货时间") = sheet(n,dict("到货时间")).Value End If |
||||
-- 作者:fendouww -- 发布时间:2020/8/18 9:46:00 -- 必须在电子格用TEXT公式转换后才能导入,我的想法能不能不在表格内转换,直接在导入时转换 |
||||
-- 作者:有点蓝 -- 发布时间:2020/8/18 9:50:00 -- 设置一下格式:http://www.foxtable.com/webhelp/topics/0044.htm |
||||
-- 作者:fendouww -- 发布时间:2020/8/18 10:51:00 -- ![]() ![]() 改了格式以后导入全部为零了,我在表格内复制为文本得到的是小数 ![]() ![]() |
||||
-- 作者:有点蓝 -- 发布时间:2020/8/18 11:20:00 -- 我测试没有问题,execl文件发上来测试一下 |
||||
-- 作者:fendouww -- 发布时间:2020/8/18 13:19:00 -- 以上,表格是用的时间格式
|
||||
-- 作者:有点蓝 -- 发布时间:2020/8/18 13:53:00 -- 测试正常呀,哪一行数据有问题? |
||||
-- 作者:fendouww -- 发布时间:2020/8/18 14:01:00 -- 我导入的都是00,以下是导入代码 Dim Book As New XLS.Book(dlg.FileName) Dim Sheet As XLS.Sheet = Book.Sheets(0) Dim dict As new Dictionary(of String,Integer) For iii As Integer = 0 To sheet.Cols.Count -1 If sheet(0,iii).Text > "" Then dict.Add(sheet(0,iii).Text,iii) End If Next Dim bh As Date For i As Integer = Tables("进仓报量").Rows.Count - 1 To 1 Step -1 Dim aa As String = .Rows(i)("工厂") Dim bb As String = .Rows(i)("款号") For n As Integer = Sheet.Rows.Count -1 To 1 Step -1 If sheet(n,dict("工厂")).text > "" AndAlso sheet(n,dict("款号")).text > "" Then Dim a1 As String = sheet(n,dict("工厂")).text Dim b1 As String = sheet(n,dict("款号")).text If a1 Like "*" & aa & "*" AndAlso b1 = bb Then If Date.TryParse(sheet(n,dict("到货日期")).Value,bh) Then .Rows(i)("到货日期") = bh End If If sheet(n,dict("到货时间")).Text > "" Then .rows(i)("到货时间") = sheet(n,dict("到货时间")).Value End If If sheet(n,dict("装箱单箱数")).Text > "" .Rows(i)("装箱箱数") = sheet(n,dict("装箱单箱数")).Value End If If sheet(n,dict("装箱单件数")).Text > "" .Rows(i)("装箱数量") = sheet(n,dict("装箱单件数")).Value End If If sheet(n,dict("实入库件数")).Text > "" .Rows(i)("实际入库数量") = sheet(n,dict("实入库件数")).Value End If Exit For End If End If Next |