以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  execel报表复选框问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=179135)

--  作者:swagger
--  发布时间:2022/8/9 21:22:00
--  execel报表复选框问题
Dim Book As New XLS.Book(ProjectPath & "Attachments\\晨午检上报表.xlsx")
Dim fl As String = ProjectPath & "Reports\\晨午检上报表.xlsx"
Dim s As String = ""
For Each r As Row In Tables("晨午检").GetCheckedRows
    s =s & "," & r("_Identify")
Next
s = s.Trim(",")
Tables("晨午检").Filter = "[_Identify] in (" & s & ")"
Book.Build() \'生成细节区
Book.Save(fl) \'保存工作簿
Dim Proc As New Process \'打开工作簿
Proc.File = fl
Proc.Verb = "Print" \'指定动作
Proc.Start()


勾选任意行打印没问题,但是在没有勾选行的前提下,显示错误:“语法错误: IN 关键字后面必须是由逗号分隔的非空表达式列表,并且必须用括号括起来。” 这个怎么修改呢?

--  作者:有点蓝
--  发布时间:2022/8/9 21:44:00
--  
既然都知道原因了,就不能加个判断吗

Dim s As String = ""
dim rs as list(of row) = Tables("晨午检").GetCheckedRows
if rs.count = 0 then
msgbox("没有")
return
end if
For Each r As Row In rs
    s =s & "," & r("_Identify")
Next
s = s.Trim(",")

--  作者:朱女士
--  发布时间:2024/10/24 13:36:00
--  
老师:您好!
  我按照您的指导意见,写的代码出现了错误信息,烦请再帮助一下。
Dim Result As DialogResult
Dim b As WinForm.TextBox = e.Form.Controls("TextBox1")
\'b.BackColor = Color.Red
Dim gzh As String = b.Value
Dim Book As New XLS.Book(ProjectPath & "Attachments\\生产工艺加工流程卡模板.xls")
Dim fl As String = ProjectPath & "Reports\\打印工艺卡.xls"
Dim s As String = ""
Dim rs As list(Of Row) = Tables("生产计划明细表").GetCheckedRows
If rs.count = 0 Then
msgbox("没有勾选")
Return
End If
For Each r As Row In Tables("生产计划明细表").GetCheckedRows
    s = s & "," & r("_Identify")
Next
s = s.Trim(",")
Tables("生产计划明细表").Filter = "[_Identify] in (" & s & ")"
Book.Build() \'生成细节区
Book.Save(fl) \'保存工作簿
Dim Proc As New Process \'打开工作簿
Proc.File = fl
\'Proc.Verb = "Print" \'指定动作
Proc.Start()
我 选中的记录和错误信息请看图片。

图片点击可在新窗口打开查看此主题相关图片如下:打印卡2.jpg
图片点击可在新窗口打开查看


--  作者:有点蓝
--  发布时间:2024/10/24 13:46:00
--  
没有开启复选框,没有勾选:http://www.foxtable.com/webhelp/topics/1776.htm

另外自己的问题请另外发帖提问,尽量不要在别人帖里提问