Label printer starts printing blank pages in large jobs - vb.net

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?

For this question, I have some thoughts which causes this behavior while printing.
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.
If everything fine, then I think you can check your printer's page setting / margin.
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.

Related

SSRS Report Builder Design Layout Issues

I can't seem to figure out why the design aspect of Report Builder/Report Designer is so messed up. Either I don't understand why it is doing this (most likely) or this is just the way it is.
Every Element I add to my report seems to not show up, align or look correct in the actual preview. If I add a line that snaps to another line which looks correct in design, looks totally incorrect in the final version. This is just one example of many, see below for images showing this behavior.
If I have a field (text box) tied to a data set and I position it in a certain area, it creates weird white space, is centered wrong or worse, when re-positioning the aforementioned line element, it seems to move other nearby elements in some erratic way. In the obfuscated example, the carrier fields are all basically stacked on top of each other, while in the preview they are spaced properly, but further down in the document if I do the same thing it ends up looking drastically different.
Is this a bug? Is this how RDL and Report Designer work? Is there some trick to element positioning? Is it relative to other elements, based off of foreground vs back ground elements? Does copying a text box to create more text boxes affect them in some way vs. creating a new element each time? I can't figure it out and do not know what to search for to find the answer to this.
This seems to be a "quirk" of how Report Designer works and I just haven't found the secret to it yet. If there is some exact positioning dialog available, I would prefer to use it instead of my mouse and these issues as I have a down-to-the-MM spec document for how this should be designed, but I cannot figure it out.
I am using Report Builder 14 for SQL Server 2016. It is a one page form (an ASN label) held within a table and all elements are within a rectangle element.
Is there an online resource or Report Designer guru who can point me in the right direction when it comes to this?
Example of the vertical line element looking incorrect in Preview/Final
Example of the vertical line element looking correct in Design View
EDIT: Like HOW does this even make sense?
SSRS renders so that the elements do not overlapp. In addition every element get enough space, vertical and horizontal. Basically you cant control this but there is a workaround.
If you put a rectangle in your report and place textboxes in that rectangle, they get rendered like you placed them. This also works in a tablix cell.
Another solution for your problem would be to display everything in one tablix cell. Your expression would be looking like this:
="Ship to: " & Fields!Adress.Value & ". Postal Code: " & Fields!PostalCode.Value
You even can add line breaks and tabs into that expression.

Excel UserForm displays at the wrong size

I'm having a very strange issue with Excel UserForms; when I display a form by clicking a command button in my worksheet, the size of the form warps significantly, making it essentially unusable. The below images illustrate this.
Form before size warping (intended size)
Form after size warping
I work with a multiple screen setup, and this sizing issue only occurred at first when just using my laptop without the additional displays; however, it has now started occurring even with my usual setup. Furthermore, in some cases, the warping compounds with each subsequent form initialization. I've included example images of this below.
Form before warping (intended size)
Form after warping (first iteration)
Compounded warping (second iteration)
Further compounded warping (third iteration)
I've tried setting the height and width properties manually, both through the properties window and through the Userform_Initialize() event, but still end up with strange results. In the properties window, the values I enter for height and width are automatically changed after I enter them, usually resulting in undesirable aspect ratios, and a similar thing happens when I try to resize with VBA. I don't think the code is the issue, as I'm simply setting the .Height and .Width properties so there isn't much room for error.
I've done relatively extensive research and haven't been able to find any information about this issue. I'm using Excel 2016; any help would be appreciated!
I think your issue might be related to mine here.
#Lance Phillips: the option you are referring to (image below found on the web) is missing on my side with Excel 2016 32-bit Windows 10 64-bit. I have no idea why. Even with an extra monitor connected.
Edit: apparently this is a new feature from Office build 9330.1000, see here.
This is a new issue that is occurring in Excel. I have seen it my applications too. In Excel General Options, set to "optimize for compatibility" and the issue should go away.
Other users may not know to set the compatibility mode. If the spreadsheet will be shared with multiple users, use this code to set the correct form size every time it is opened.
Private Sub UserForm_Initialize()
'
' Initialize frm
' (This runs everytime the form is opened)
' frm is the form name
'
' Reset the size
With frm
' Set the form size
Height = {enter desired form height}
Width = {enter desired form width}
End With
End Sub
Check your magnification settings in Windows (Ease of Access). It completely threw my forms sizes. Some were large, others small. Font sizes were as your examples. When a form was created, it inherited the Windows magnification.

SSRS 2008 - Multiple report page discrepancies when exporting to pdf

I am creating a report using SSRS 2008 consisting of a page with a single tablix, a header, and a footer. As far as I'm concern, the report itself isn't that complex. But when I tried to export it to PDF format for printing, several issues ensue:
When using the expression ="Page " & Globals!PageNumber & " of " & Globals!TotalPages in a textbox in the header, the displayed TotalPage number is not equal to the actual total pages in the report.
The pages after the printed TotalPages in the report does not display the page header and footer anymore. For example the actual total page number of the report is 50 but whats printed in the header is Page x of 42; after page 42, the pages does not display the Header and Footer anymore
The tablix applies pagebreaks at random pages eventhough there is no pagebreak condition to any group in the tablix nor on the tablix itself causing half of the page to be blank and the continuation is on the next page.
Does anyone know any fix or workaround on these issues? I've searched high and low on the internet on how to fix these issues but I always arrive at dead end. Please leave comments that you think can help, it will be greatly appreciated. Thanks!
I've helped solve a similar problem a few weeks ago.
Sometimes, any errors in expressions or custom code has side-effects that cascades into the report layout (sometimes causing pagination anomalies, layout issues, etc.). Just check if your expressions are error free, or if there are any scenarios that can cause some expressions or custom code to have errors (like null references, etc).
Also, check if you are calling custom code in a hidden control. From experience with SSRS 2008, custom code inside a hidden control or table row produces side-effects on total page counts, although I've yet to verify if these side effects still happen on newer versions of SSRS (like SSRS 2008 R2).

RDLC Report showing data on other page if data is more

I have a bill application in winforms using reportviewer and showing rdlc report in it, I have a main report and a subreport in it
now the problem is that when i have less than 40 items it shows the report fine, but if its more than that the data comes from next page, please see the reports and ourput
Main Report
SubReport
Normal display when 25 records
When it is 40 records pg1
Second page
any help will be appriciated
try Unchecking Keep together on one page if possible option in Page break options.
I'm using vs2010, and it looks like you're in 08? so it might be a little different but I'll give it a try (mostly because I am looking for some help as well and I know how frustrating it is using this when there's not a lot of "quality" answers out there for specific problems).
In the subreport rdlc file, make sure that the "PageBreak" property (on the table containing your columns) isn't set to "start." I would just set it to "none."
What I believe that is happening is that it's moving it to the next page because it won't fit on the first page. what you can do to try to get around that is include everything on the main report in a rectangle (in the rectangle, set pagebreak = none, and keeptogether=true [I'm not sure if you actually want keeptogether=true... if it squeezes everything onto one page by resizing it set it to false]).
Hope I helped

How to split a Crystal Reports subreport across a page break?

I'm using Visual Studio 2005 and writing in VB.NET.
I have a subreport in a Crystal Reports report consisting of a list of log entries. Sometimes the list of log entries is long enough that it would extend onto the next page. What I see happening is that the list appears on the next page, leaving a big blank space at the bottom of the first page.
I've tried unchecking the "Keep Together" boxes in the "Experts" in a number of different places (sections, groups, etc.) but see no change in the output.
I'm guessing that this isn't the right way to go, but do you know what is?
(I'll be glad to provide more information if I haven't given enough.)
Thanks as always!
remove the subreport's 'keep object together' option.