cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Page N 0f M Crystal Report

0 Kudos

Hello ,

We are using Crystal Report X1 Release2 as the designer.

Our application is windows application and we are dynamically loading the report file and assigning the data source like below:

var testreport = new ReportDocument();
testreport .Load("Test.rpt");
testReport------- Assign datasource here.

The reports generation is fine and it opens a viewer like below :

When we press save file explorer like below appears :

and then the whole application crashes.

When we investigated further , from the below link we found out that there is a paging field (please refer below image)

https://answers.sap.com/questions/9724230/index.html

as per below image. So if we remove this field (Page N of M) it works fine if report has multiple pages.But how about again if we have single page. We have lot of reports (.rpt) files with Page N of M

So is there any option or update or fix we can do here which fixes this. We are using crystal report runtime -

13.0.22.2668.

Our DLL's are 13.0.24.

Please suggest further thanks.

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

Page N of M is problematic in a number of ways. The biggest is that when you use it, the report has to render all of the pages - even subreports - before it can either display or export the report. Also, the export from Save regenerates the report completely - it doesn't convert what's in the viewer. So, if the report is large, contains one or more subreports that run multiple times, had lots of images, or any one of a number of other things that will cause it to do a lot of swapping to disk (in its own temp files - Crystal doesn't use Windows swap space), you could be running out of memory or swap space.

Since you're using Crystal for VS, you could potentially write a program that will go through all of your reports and remove the Page N of M and replace it with just PageNumber and then save each report.

-Dell

0 Kudos

Thanks for the response and help. Following your response,We are trying to suppress Page N of M with conditional statement such as:

TotalPageCount > 1

Not sure it will or not but just trying it out.

DellSC
Active Contributor

TotalPageCount has the same issue as Page N of M - Crystal has to generate ALL of the pages so that it knows how many pages there are before it can show the first page of the report.

-Dell

0 Kudos

Thanks for the response.

I did like below image is that correct ,please suggest thanks.

0 Kudos

If i just use below ,and remove TotalPageCount that works well for us with no issues but it gives only PageNumber.

"Page " & CStr(PageNumber,0)

Thanks.

Abhilash

DellSC
Active Contributor

That is the correct way to handle it - without Page N of M and without TotalPages. This way Crystal can generate the report one page at a time as it gets to that page and dismiss the page from memory if necessary when it's done saving or emailing it. If you have to display the total number of pages, Crystal has to generate the entire report into memory and then go through each page and and set the page numbers.

-Dell

0 Kudos

Hello again Dell,

Thanks for previous reponses. So i tried using formula like below

"Page " & CStr(PageNumber,0) and it just shows me the page number without total page count.So crashing stops here while saving but what is happening with this is ,it stops user to view all the pages. Like below screen if you see there are total 3 pages for this report but the navigation button to view pages is disabled. Any solution we can fix it or any other way please thanks?

Answers (1)

Answers (1)

DellSC
Active Contributor
0 Kudos

Which version of the Crystal SDK are you using and what version of Visual Studio?

-Dell

0 Kudos

Hello Dell,

Thanks for the response. Please find below details -

1. Visual Studio 2017 Professional

2. Crystal Report SDK - 13.0.24.2970

Please let me know if need more information.

Abhilash

DellSC
Active Contributor

Is this a web application or a Windows app? If it's a web app, are you storing the report in a session variable in the PageInit event handler? If not, that is probably your problem. If that's not the issue, please open this as a new question so that others will see it.

-Dell

0 Kudos

Thanks for the response Dell.

It is windows application.

So is there any solution if window application please thanks. If not then we just need to keep it as it is.Please suggest.

Thanks again.

Abhilash

DellSC
Active Contributor

The only thing I can think of would be to upgrade to the latest version of the SDK (SP25). I can't guarantee that will fix the issue, but it might. You'll need to install that version into VS, recompile your application with it, then deploy it with the new version of the runtime. You can get to the download link through here: https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports%2C+Developer+for+Visual+Studio+Downloads. When you get to the download page, the orange button is for the .exe that integrates into VS, the blue buttons are for the various runtime options that are available for deploying your application.

-Dell

0 Kudos

Thanks Dell for the response.
Thanks for your inputs.

Sure, so we will discuss internally in the team and then see if we need to update or not.

Abhilash

0 Kudos

Thanks Dell for the response. So in the last image i shared the disabling of navigation forward and backward button was due to our own code. When i commented that piece of code, then navigator arrows were enabled. So we are fine with this now.

Thank you for your assistance.

Abhilash