以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 关于复制粘贴数据 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=196083) |
-- 作者:syst -- 发布时间:2025/3/27 17:19:00 -- 关于复制粘贴数据 蓝老师,最近老是遇到一个问题 在excel表格复制产品编号到窗口表的时候,偶尔会报这个错误;通过快捷键ctrl+V复制; 有时候是提示下面图片的样式 退出来重新登录又没事;出现以后就是一个大红色的叉叉; 另外发现好像虽然禁止了复制粘贴,只要不禁止编辑,还是可以通过快捷键进行粘贴数据的,有什么办法能够禁止粘贴数据进来么? 谢谢!
|
-- 作者:有点蓝 -- 发布时间:2025/3/27 17:36:00 -- 设置一下:http://www.foxtable.com/webhelp/topics/1515.htm 表格有什么事件代码和表达式计算?
|
-- 作者:syst -- 发布时间:2025/3/27 18:02:00 -- \'///自动填入产品信息/// If e.DataCol.Name = "商品编号" Then If e.DataRow.IsNull("仓储编号") Then If e.NewValue Is Nothing Then e.DataRow("销售单价") = Nothing End If Else Dim dr As DataRow dr = DataTables("仓储明细").sqlFind("[商品编号] = \'" & e.DataRow("商品编号") & "\'and [仓储编号]=\'" & e.DataRow("仓储编号") & "\'") If dr IsNot Nothing Then e.DataRow("销售单价") = dr("公开售价") e.DataRow("产品名称") = dr("商品名称") e.DataRow("规格型号") = dr("规格型号") e.DataRow("单位") = dr("单位") e.DataRow("销售单价") = dr("公开售价") Else MessageBox.Show("请检查当前仓库是否存在该产品名称") \' End If End If End If \'///对出库信息进行记录/// Select Case e.DataCol.Name Case "出库1" If e.newvalue Is Nothing And e.oldvalue Is Nothing Then e.DataRow("出库时间1") = Nothing Else e.DataRow("出库时间1") = Date.today() End If Case "出库2" If e.newvalue Is Nothing And e.oldvalue Is Nothing Then e.DataRow("出库时间2") = Nothing Else e.DataRow("出库时间2") = Date.today() End If Case "出库3" If e.newvalue Is Nothing And e.oldvalue Is Nothing Then e.DataRow("出库时间3") = Nothing Else e.DataRow("出库时间3") = Date.today() End If Case "出库4" If e.newvalue Is Nothing And e.oldvalue Is Nothing Then e.DataRow("出库时间4") = Nothing Else e.DataRow("出库时间4") = Date.today() End If Case "出库5" If e.newvalue Is Nothing And e.oldvalue Is Nothing Then e.DataRow("出库时间5") = Nothing Else e.DataRow("出库时间5") = Date.today() End If End Select \'///从父表提取相关信息/// Select Case e.DataCol.Name Case "商品编号" Dim pr As DataRow = e.DataRow.GetParentRow("销售子任务") If pr IsNot Nothing Then e.DataRow("客户") = pr("客户") End If Dim pr1 As DataRow = e.DataRow.GetParentRow("销售任务") If pr1 IsNot Nothing Then e.DataRow("业务年度") = pr1("业务年度") e.DataRow("销售类型") = pr1("销售类型") e.DataRow("任务类别") = pr1("任务类别") End If End Select \'///动态生成合计金额的表达式/// Select Case e.DataCol.Name Case "数量", "销售单价" DataTables("销售任务").DataCols("合计金额").Expression = "IsNull(Sum(Child(销售_子任务).合计金额),0)" End Select \'///计算库存以及虚拟库存/// Select Case e.DataCol.Name Case "数量" If e.NewValue < 0 Then e.DataRow("性质") = "退货" Else e.DataRow("性质") = Nothing End If Dim dr As DataRow dr = DataTables("仓储明细").SQLFind("[商品编号] = \'" & e.DataRow("商品编号") & "\'and [仓储编号]=\'" & e.DataRow("仓储编号") & "\'") If dr IsNot Nothing Then dr("虚拟库存") = dr("虚拟库存") - e.NewValue + e.OldValue dr.Save() End If Case "出库1", "出库2", "出库3", "出库4", "出库5" Dim dr1 As DataRow dr1 = DataTables("仓储明细").SQLFind("[商品编号] = \'" & e.DataRow("商品编号") & "\'and [仓储编号]=\'" & e.DataRow("仓储编号") & "\'") If dr1 IsNot Nothing Then dr1("库存") = dr1("库存") - e.NewValue + e.OldValue dr1.Save() End If End Select e.DataTable.Save() 有一些事件代码以及动态生成一些表达式 但是跟粘贴这个编号触发的好像没有发现什么 值是 null的
[此贴子已经被作者于2025/3/27 18:05:44编辑过]
|
-- 作者:syst -- 发布时间:2025/3/27 18:09:00 -- For Each dt9 As DataTable In DataTables dt9.AllowClipBoard = False Next 关于那个复制,已经在项目的afteropenproject 事件里面设置过了 还是能够把别的数据直接通过快捷键粘贴进去;
|
-- 作者:有点蓝 -- 发布时间:2025/3/27 20:25:00 -- 把这些事件代码去掉,在复制粘贴有没有问题? |
-- 作者:syst -- 发布时间:2025/3/27 22:00:00 -- 他不是每次粘贴都有问题, 就是偶尔会出现,大部分时间都是正常的;
|
-- 作者:有点蓝 -- 发布时间:2025/3/27 22:21:00 -- 那要多测试找出规律。找出粘贴什么列的数据会有问题 |