cancel
Showing results for 
Search instead for 
Did you mean: 

Get TotalPageCount or last page number

Former Member
0 Kudos

Hi... i didn't think that the new crystal report 2008 could be so different to use from crystal 8!

I have a simple question. how cai i know the totalpagecount from vb? i need this parameter because i need to show a printdialog with "from page to page" before calling .printtoprinter method...

in vb6 with crystal 8 i just write:

Rpt.PrintingStatus.NumberOfPages

and now??????

P.S.: i can't understand why the old RDC was much more easy to use! with VB6 i can add sort field, get number of pages... etc. now i had to write a book!!!

Accepted Solutions (1)

Accepted Solutions (1)

former_member184995
Active Contributor
0 Kudos

Try this:

The following sample code demonstrates how to retrieve the number of pages from your 'ReportDocument' object. Assuming that your 'ReportDocument object' is called 'crReport', use the following VB.NET code to return the number of pages in a report:

====================

NOTE:

Logon and parameter field values must be provided prior to executing this code.

====================

Dim nPages as Integer

nPages = crReport.FormatEngine.GetLastPageNumber(New CrystalDecisions.Shared.ReportPageRequestContext)

Jason

Former Member
0 Kudos

thanks... it seems to works. i only try with a report with "page n of m", i'll try tomorrow with report w/o "page n of m"...

thanks but... where did you find this code? with this formatengine it's possible to add sort field at run-time???

former_member184995
Active Contributor
0 Kudos

It is in Note [1216240 |https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_dev/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do]

You will want to search the notes database for information like this.

The formatengine is undocumented so I do not know about that, but I dont think you would use it to add a sort field at runtime.

Create a new thread asking that question and maybe someone has code already for it.

Make sure you search the forum first.

Jason

Answers (0)