以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]报表问题  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=89360)

--  作者:鸡蛋
--  发布时间:2016/8/19 17:36:00
--  [求助]报表问题

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20160819173841.png
图片点击可在新窗口打开查看

请问,为什么我没有选择任何一个复选框,预览的时候,还是会固定显示其中的三列,会是在哪里出错?预览代码如下:
Dim tb As Table = Tables("t246")
For Each c As Col In tb.Cols
    c.visible = False
Next
Dim lst As WinForm.CheckedListBox
lst = Forms("报表").Controls("CheckedListBox1")
tb.Cols("F4362").visible = lst.GetItemChecked(0)
tb.Cols("F4363").visible = lst.GetItemChecked(1)
tb.Cols("F4366").visible = lst.GetItemChecked(2)
tb.Cols("F4383").visible = lst.GetItemChecked(3)
tb.Cols("F4384").visible = lst.GetItemChecked(4)
tb.Cols("F4385").visible = lst.GetItemChecked(5)
tb.Cols("F4386").visible = lst.GetItemChecked(6)
tb.Cols("F4387").visible = lst.GetItemChecked(7)
tb.Cols("F4388").visible = lst.GetItemChecked(8)
tb.Cols("F4389").visible = lst.GetItemChecked(9)
tb.Cols("F4390").visible = lst.GetItemChecked(10)
tb.Cols("F4391").visible = lst.GetItemChecked(11)
tb.Cols("F4393").visible = lst.GetItemChecked(12)
tb.Cols("F4392").visible = lst.GetItemChecked(13)
tb.Cols("F4397").visible = lst.GetItemChecked(14)
tb.Cols("F4398").visible = lst.GetItemChecked(15)
tb.Cols("F4399").visible = lst.GetItemChecked(16)
tb.Cols("F4407").visible = lst.GetItemChecked(17)
tb.Cols("F4408").visible = lst.GetItemChecked(18)
tb.Cols("F4409").visible = lst.GetItemChecked(19)
tb.Cols("F4410").visible = lst.GetItemChecked(20)
tb.Cols("F5319").visible = lst.GetItemChecked(21)
tb.Cols("F4411").visible = lst.GetItemChecked(22)
tb.Cols("F5296").visible = lst.GetItemChecked(23)
tb.Cols("F4416").visible = lst.GetItemChecked(24)
Dim doc As New PrintDoc \'定义一个新报表
Dim rt As New prt.RenderTable \'定义一个新表格
Dim hd As Integer = tb.HeaderRows \'获得表头的层数
doc.PageSetting.Landscape = True
rt.Style.Font = tb.Font
tb.CreateReportHeader(rt,False) \'生成表头,包括所有列
For c As Integer = 0 To tb.Cols.Count -1 \'逐列设置和填入内容
    rt.Cols(c).Width = tb.Cols(c).PrintWidth \'列宽等于实际列宽
    If tb.Cols(c).IsNumeric OrElse tb.Cols(c).IsDate Then \'如果是数值或日期列
        rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Right \'数据水平靠右
    End If
    For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容
        
        rt.Cells(r + hd, c).Text = tb(r,c)
        
    Next
Next
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) \'灰色网格线
rt.CellStyle.Spacing.All = 0.5 \'单元格内距设为0.5毫米
rt.RowGroups(0, tb.HeaderRows).Header = prt.TableHeaderEnum.All \'利用行组功能设置表头
doc.Body.Children.Add(rt) \'将表格加入到报表
doc.Preview()
For Each c As Col In tb.Cols
    c.visible = True
Next


--  作者:大红袍
--  发布时间:2016/8/19 17:40:00
--  
 不应该的,做个例子发上来。
--  作者:鸡蛋
--  发布时间:2016/8/19 17:55:00
--  [求助]
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:用户缴退费系统.rar

因为这个是关联在一起,所以很难重新拆分做一个独立的,所以只能整个发上来了。  打开之后在缴费户卡窗口,按年度2012进行查询,然后就有报表按钮,会出现图片那一个。
--  作者:大红袍
--  发布时间:2016/8/19 18:07:00
--  
Dim tb As Table = Forms("缴费户卡").Controls("Table1").Table
For Each c As Col In tb.Cols
    c.visible = False
Next
Dim lst As WinForm.CheckedListBox
lst = Forms("报表").Controls("CheckedListBox1")
tb.Cols("F4362").visible = lst.GetItemChecked(0)
tb.Cols("F4363").visible = lst.GetItemChecked(1)
tb.Cols("F4366").visible = lst.GetItemChecked(2)
tb.Cols("F4383").visible = lst.GetItemChecked(3)
tb.Cols("F4384").visible = lst.GetItemChecked(4)
tb.Cols("F4385").visible = lst.GetItemChecked(5)
tb.Cols("F4386").visible = lst.GetItemChecked(6)
tb.Cols("F4387").visible = lst.GetItemChecked(7)
tb.Cols("F4388").visible = lst.GetItemChecked(8)
tb.Cols("F4389").visible = lst.GetItemChecked(9)
tb.Cols("F4390").visible = lst.GetItemChecked(10)
tb.Cols("F4391").visible = lst.GetItemChecked(11)
tb.Cols("F4393").visible = lst.GetItemChecked(12)
tb.Cols("F4392").visible = lst.GetItemChecked(13)
tb.Cols("F4397").visible = lst.GetItemChecked(14)
tb.Cols("F4398").visible = lst.GetItemChecked(15)
tb.Cols("F4399").visible = lst.GetItemChecked(16)
tb.Cols("F4407").visible = lst.GetItemChecked(17)
tb.Cols("F4408").visible = lst.GetItemChecked(18)
tb.Cols("F4409").visible = lst.GetItemChecked(19)
tb.Cols("F4410").visible = lst.GetItemChecked(20)
tb.Cols("F5319").visible = lst.GetItemChecked(21)
tb.Cols("F4411").visible = lst.GetItemChecked(22)
tb.Cols("F5296").visible = lst.GetItemChecked(23)
tb.Cols("F4416").visible = lst.GetItemChecked(24)
Dim doc As New PrintDoc \'定义一个新报表
Dim rt As New prt.RenderTable \'定义一个新表格
Dim hd As Integer = tb.HeaderRows \'获得表头的层数
doc.PageSetting.Landscape = True
rt.Style.Font = tb.Font
tb.CreateReportHeader(rt,True) \'生成表头,包括所有列
For c As Integer = 0 To tb.Cols.Count -1 \'逐列设置和填入内容
    If tb.Cols(c).Visible Then
        rt.Cols(c).Width = tb.Cols(c).PrintWidth \'列宽等于实际列宽
        If tb.Cols(c).IsNumeric OrElse tb.Cols(c).IsDate Then \'如果是数值或日期列
            rt.Cols(c).Style.TextAlignHorz = prt.AlignHorzEnum.Right \'数据水平靠右
        End If
        For r As Integer = 0 To tb.Rows.Count -1 \'开始填入该列内容
           
            rt.Cells(r + hd, c).Text = tb(r,c)
           
        Next
    End If
Next
rt.Style.Gridlines.All = New prt.Linedef(Color.Gray) \'灰色网格线
rt.CellStyle.Spacing.All = 0.5 \'单元格内距设为0.5毫米
rt.RowGroups(0, tb.HeaderRows).Header = prt.TableHeaderEnum.All \'利用行组功能设置表头
doc.Body.Children.Add(rt) \'将表格加入到报表
doc.Preview()
For Each c As Col In tb.Cols
    c.visible = True
Next
tb.Cols("F4385").visible = False
tb.Cols("F4385").visible = False
tb.Cols("F4386").visible = False
tb.Cols("F4387").visible = False