Foxtable(狐表)用户栏目专家坐堂 → 关于打印数据


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

主题:关于打印数据

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


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
关于打印数据  发帖心情 Post By:2017/11/24 9:09:00 [显示全部帖子]

在窗体中筛选过符合条件并指定要打印的列呢?

 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2017/12/6 9:05:00 [显示全部帖子]

我打印窗体表的时候发现本来表中的数据是筛选过的数据怎么打印的时候是数据库中所有的数据呢?怎么打印窗体表中的数据呢?
[此贴子已经被作者于2017/12/6 9:06:00编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2017/12/6 16:12:00 [显示全部帖子]

 打印的代码
Dim lieming As WinForm.CheckedListBox = e.Form.Controls("lieCheckedListBox")
Dim s As String
For Each c As Col In Tables("流量卡资料").cols
            s=s &"|"& c.Name
        Next
        lieming.ComboList=s
e.form.Controls("Table1").Table.DataSource =DataTables("流量卡资料")
e.form.controls("Table1").Table.Filter = Tables("流量卡资料").Filter

提醒窗体表的数据是最近10天即将到期的数据,可是已打印就是所有的数据


 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2017/12/6 19:24:00 [显示全部帖子]

Dim lieming As WinForm.CheckedListBox = e.Form.Controls("lieCheckedListBox")
Dim t As Table = Tables("流量卡资料")
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.baseForm.hide
    e.Form.Close
    Tables("流量卡资料").Print(True, False)
    t.SetColVisibleWidth(str)


 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2017/12/6 20:49:00 [显示全部帖子]

我的程序是这样执行的加载提醒窗体后将符合条件的数据显示在提醒窗体上,当单击打印按钮后弹出一个打印设置窗体(此窗体有一个窗体表是副表,加载的是提醒窗体表的数据,来调整打印裂的宽度,)怎么调后不管用呢?

 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2017/12/6 21:13:00 [显示全部帖子]

我调整打印窗体表的宽度不管用

 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  7楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2017/12/6 22:00:00 [显示全部帖子]

可以了刚才把 Dim t As Table = e.form.controls("Table1").Table 代码形成Dim t As Table = e.form.controls("提醒窗体_Table1").Table 了,不过还有一个问题就是多久的以后打印调整窗体一直置顶影响打印预览,打印调整窗体又是模式窗体,以前打印的表是Tables("流量卡资料")中的数据在打印之前是将它关闭了,写了如下代码:
e.Form.baseForm.hide
'e.Form.Close
现在打印的是该窗体表就不能用代码把它关闭了,如果关闭就无法打印该窗体的表了,怎么处理呢?
[此贴子已经被作者于2017/12/6 22:11:33编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  8楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2017/12/7 9:05:00 [显示全部帖子]

Dim lieming As WinForm.CheckedListBox = e.Form.Controls("lieCheckedListBox")
If sjdcxzb="POS机库存资料" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="POS机查询数据表" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
   ElseIf sjdcxzb="POS机绑定商户历史记录表" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="流量卡绑定商户历史记录表" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="代理商资料表" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="POS机信息表" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="供应商资料" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="仓库资料" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="物品表" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="客户资料" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="流量卡资料" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="流量卡充值提醒表" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="客户资料提醒表" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="杂项库存资料" Then
    Dim t As Table =  e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
ElseIf sjdcxzb="杂项统计" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
End If


甜老师您看看哪错了怎么单击打印按钮打印调整窗体不隐藏呀?
已解决


还有一个问题就是如果"流量卡历史绑定记录查询窗体"中的表如果作为副本代码可如下写
  e.form.controls("Table1").Table.Filter = Tables("流量卡历史绑定记录查询窗体_Table2").Filter

如果不是作为副本代码怎么写呢?



[此贴子已经被作者于2017/12/7 9:32:33编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  9楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2017/12/9 8:14:00 [显示全部帖子]

Dim lieming As WinForm.CheckedListBox = e.Form.Controls("lieCheckedListBox")
If sjdcxzb="POS机库存资料表" Then
    Dim t As Table = e.form.controls("Table1").Table
    Dim str As String = t.getColVisibleWidth
    If lieming.value > "" Then
        For Each c As Col In t.Cols
            c.Visible = False
        Next
        For Each s As String In lieming.value.split(",")
            t.cols(s).visible = True
        Next
    End If
    e.Form.visible = False '隐藏
    t.Print(True, False)
    t.SetColVisibleWidth(str)
    e.Form.visible = True '显示
  End If
运行后发现::
(1)如果列表框值全选和全不选打印的列都一样,都是全部列,这样设置如果列表框未选l列时,单击打印按钮不执行打印操作呢?
(2)怎么设置不打印表的行号呢?




 回到顶部
帅哥哟,离线,有人找我吗?
裴保民
  10楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1989 积分:12631 威望:0 精华:0 注册:2017/4/3 15:01:00
  发帖心情 Post By:2017/12/9 9:22:00 [显示全部帖子]

运行后发现:和之前一样


 回到顶部
总数 14 1 2 下一页