Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Retrieve TotalPageCount in vb.net?

Status
Not open for further replies.

millerk

Programmer
Jul 5, 2002
133
US
I've got a VB.Net app that is generating reports and exporting them to pdf, xls, etc.
I want to be able to capture the total page count of the generated report.
I know there is a special field(or function) called TotalPageCount and I'm using that on the report itself.

But is it possible to access that TotalPageCount value from my vb.net code?
Either before or after the .Export would be fine.

Thanks
 
I need something like this too, but I'm not sure if it's possible.

I cheated to get the PageCount when previewing a report in the CrystalDecisions.Windows.Forms.CrystalReportViewer control, but to get the count without previewing I have no idea.

Dim ctrl As System.Windows.Forms.Control
Dim PageView As PageView
Dim TabControl As TabControl
Dim TotalPageCOunt as integer

Try

For Each ctrl In Me.CrystalReportViewer1.Controls

If TypeOf (ctrl) Is CrystalDecisions.windows.forms.PageView Then

PageView = CType(ctrl, CrystalDecisions.windows.forms.PageView)

If TypeOf PageView.Controls.Item(0) Is System.Windows.Forms.TabControl Then

TabControl = CType(PageView.Controls.Item(0), System.Windows.Forms.TabControl)

If TypeOf TabControl.Controls.Item(0) Is CrystalDecisions.Windows.Forms.DocumentControl Then

DocControl = CType(TabControl.Controls.Item(0), CrystalDecisions.Windows.Forms.DocumentControl)

If TypeOf DocControl.Controls.Item(0) Is CrystalDecisions.Windows.Forms.PageControl Then

PageControl = CType(DocControl.Controls.Item(0), CrystalDecisions.Windows.Forms.PageControl)

TotalPageCount = PageControl.PageObject.LastPageNumber

End If

End If

End If

End If

Next

Catch ex As Exception
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top