11
votes

I'm running into an extremely strange issue that a user of mine is reporting: A Crystal Reports report is printing blank pages past a certain point. My troubleshooting has sort of narrowed down the culprit, but at the same time, has displayed some inconsistent results.

Here's the lowdown:

  • The application is a VB.NET application, using .NET 4.
  • There are multiple Crystal Report reports embedded in the solution, and a single form is used to display and print any report.
  • Which report to display is handled through the code backend, and assigned to the form's CrystalReportViewer object before showing the form.
  • For the problem report, the datasource comes from a SQL query run in the code, and then assigned as the report's datasource, and then the report is assigned as the reportsource for the CRV object in the form.
  • The label printer is attached via USB to the computer in question, with the installer used to provide the drivers.
  • If it matters, it's a Citizen CLP-7201e label printer.

The code that assigns the datasource to the report is as follow:

    myCommand = New SqlClient.SqlCommand(strSQL, conPlanning)
    myCommand.ExecuteNonQuery()

    Da = New SqlClient.SqlDataAdapter(myCommand)

    Da.Fill(dsData, "TempPrintLabels")

    rptPrintLabels.SetDataSource(dsData.Tables(0))
    rptPrintLabels.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Portrait

    frmReports.rptViewer.ReportSource = rptPrintLabels

    frmReports.Show()

strSQL is a basic SQL statement, based on which report is selected from this particular form. The report's SQL query is, SELECT * FROM TempPrintLabels.


There's the basic info. The report generates fine, and for reports with ~100 labels, it prints fine. The strangeness happens when the report exceeds that limit; it's somewhere in the 95-120 label range. It doesn't seem to be consistent. The report will print, up until it hits that certain point. At that time, it will print nothing but blanks for the rest of the report. There will be as many blanks as there are supposed to be remaining pages. If you start the job again at the point where the blanks started, though, it prints fine.

When I look at this report in the CrystalReportViewer, it looks fine; all the labels render properly. When I print it to a PDF or text file printer, all the pages are there. So the report and print generation seems to be working to me.

I thought it was the printer. To test that, I printed a 185 page job to PDF, and then printed that to the printer. That printed absolutely fine.

I'm at a loss to explain this, or even diagnose this further. There is no code in the form for printing; it uses the CrystalReportViewer object to handle everything. If it was this CRV object, the printing to PDF should've given me blank pages. It didn't. If it was the printer, it should have started printing blanks from the PDF right around the same point as printing directly from the CRV object did. It didn't.

What else can I look for?

1
Hi, @Ajay2707. While your edit is appreciated, you're modifying specific sections that shouldn't be. For instance, CrystalReportViewer are objects that are referenced as such in Visual Studio; there should be no space between the words. Beyond that, the contractions are my own style, and have no bearing on improvement.fbueckert
Is it the case that one particular report is demonstrating this blanking behavior, or does this happen across all Crystal Reports that are in excess of 90-120 labels?ChicagoMike
@ChicagoMike There is only the one report that prints that many labels, so unfortunately, there is no other report I can test to see if it's an isolated incident.fbueckert
Could you create a report that does that? It sounds silly, I know, but if your newly created report is able to print 120 labels, that's a huge insight.ChicagoMike
@ChicagoMike I might be able to, but I'm unsure of what value that would offer; care to share your hypothesis?fbueckert

1 Answers

1
votes

For this question, I have some thoughts which causes this behavior while printing.

  1. It may the width issue of your all label's length exceeds from the page size. So you can check all the labels and pages are not blank when you shrink the width of labels (even labels not show properly, we can handle separately). If it shows not (as currently you getting), then you just handle labels width by "Can grow" option to true for all labels.

  2. If everything fine, then I think you can check your printer's page setting / margin.

  3. If above is not work, then either create new report or existing report with just adding static labels and values and then first preview and then call from code. Something you find with this.

As per my experience(I may be wrong in this case), whenever blank page comes in crystal report when your columns will increase, the report's width create an issue. So either set report width to decrease or set printer page bigger. So it print, other wise it not throw error, but give blank pages.