在报表中求出组名所在的打印页数(vb.net 2005)

flongsoftware 2010-03-28 04:44:34
阿泰,请有空帮我解决这个问题:
我要在报表中求出组名所在的页数(vb.net 2005)
举个例子:
编号 名称 首字拼音
001 abc a
002 acd a
004 dcd d
005 ggg g
006 gff g


以首字拼音分组后

a
001 abc
002 acd
d
004 dcd
g
005 ggg
006 gff

现在想知道组名a,d,g所在页数,怎么在vb.net知道?

小弟初学,请帮帮忙啊
...全文
140 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
阿泰 2010-05-20
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 flongsoftware 的回复:]

谢谢楼上,看不太懂.学习..我又发现用一个比较笨但速度快很多的方法可以完成:

1.在组名加一个页数.并抑制显示.
2.打印完成后.导出htm文件.
3.使用htm文件用正则找出.
4.制作索引文档

速度还挺快的.可以满足我的要求.
[/Quote]



变通一下,往往能有更好的解决方法
感谢flongsoftware分享
flongsoftware 2010-05-20
  • 打赏
  • 举报
回复
谢谢楼上,看不太懂.学习..我又发现用一个比较笨但速度快很多的方法可以完成:

1.在组名加一个页数.并抑制显示.
2.打印完成后.导出htm文件.
3.使用htm文件用正则找出.
4.制作索引文档

速度还挺快的.可以满足我的要求.
东莞寻香苑 2010-05-19
  • 打赏
  • 举报
回复
好像没有什么好办法

(1)以首字拼音建立分组
(2)建立两公式:
1.DimPrint为:shared stringvar print:='';把它放报表头,抑制它显示
2.print为:
whileprintingrecords;
stringvar print;
if (onfirstrecord) or ({首字拼音} <> Previous ({首字拼音})) then
print:= print +{首字拼音}+ToText(PageNumber) +CHR(13)

把公式print拖入到详细资料区;抑制它显示,后面公式输入: not onlastrecord
资料其它元素,都抑制它显示
 (3)CrystalReportViewer1.ShowLastPage()

水晶报表最后一页就是索引

flongsoftware 2010-05-19
  • 打赏
  • 举报
回复

Private Sub CHK()
Dim CL As New ClsSQLDbOperation _
("D:\Backup\我的文档\Visual Studio 2005\" & _
"Projects\好易手机下载系统\好易手机下载系统\bin\Debug\data", "FlongDB")

For Each row As DataRow In CL.Fnc_GetSQL("select * from artist where stylename ='华人男歌手' order by artistname").Rows
CrystalReportViewer1.ShowFirstPage()
Dim NumberPage As String = ""
Dim nw As Date = Now
Dim pstr As String = row.Item("artistname")
If pstr <> "[信]" Then
'CrystalReportViewer1.Visible = False
up:
Dim NB As Boolean = CrystalReportViewer1.SearchForText("【" & pstr & "】")

If NB Then
NumberPage &= CrystalReportViewer1.GetCurrentPageNumber() & ","
CrystalReportViewer1.ShowNextPage()
GoTo up
Else
Console.WriteLine("【" & row.Item("artistname") & "】" & "[" & NumberPage & "]")
CrystalReportViewer1.ShowPreviousPage()
End If
End If

Next
End Sub
flongsoftware 2010-05-19
  • 打赏
  • 举报
回复
Private Sub CHK()
Dim CL As New ClsSQLDbOperation _
("D:\Backup\我的文档\Visual Studio 2005\" & _
"Projects\好易手机下载系统\好易手机下载系统\bin\Debug\data", "FlongDB")

For Each row As DataRow In CL.Fnc_GetSQL("select * from artist where stylename ='华人男歌手' order by artistname").Rows
CrystalReportViewer1.ShowFirstPage()
Dim NumberPage As String = ""
Dim nw As Date = Now
Dim pstr As String = row.Item("artistname")
If pstr <> "[信]" Then
'CrystalReportViewer1.Visible = False
up:
Dim NB As Boolean = CrystalReportViewer1.SearchForText("【" & pstr & "】")

If NB Then
NumberPage &= CrystalReportViewer1.GetCurrentPageNumber() & ","
CrystalReportViewer1.ShowNextPage()
GoTo up
Else
Console.WriteLine("【" & row.Item("artistname") & "】" & "[" & NumberPage & "]")
CrystalReportViewer1.ShowPreviousPage()
End If
End If

Next
End Sub
这个方法勉强可以应付,但速度奇慢,请大家讨论一下能否可以改进一下...
flongsoftware 2010-04-06
  • 打赏
  • 举报
回复
谢谢各位!
古今多少事 2010-04-04
  • 打赏
  • 举报
回复
试试这样:勾选组页脚节的【之后重置页码】,在页脚节拖个【组名字段】+页码。
阿泰 2010-04-04
  • 打赏
  • 举报
回复
基本没有。
可以考虑按组条数事先算出来,然后做完后按文本传到报表里去
挺麻烦。

flongsoftware 2010-04-04
  • 打赏
  • 举报
回复
我想打印以组名作为索引目录
例如:
a-第1页
b-第2页
.
.
g-第8页
有什么代替方法吗?
阿泰 2010-03-28
  • 打赏
  • 举报
回复
程序中取不到这个页码。
你要取这个页码实现什么效果呢?

4,818

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧