Microsoft Dynamics NAV 2013 RDLC Reporting RBC Attacks: Part 2 of 10

Microsoft Dynamics NAV 2013 RDLC Reporting RBC Attacks: Part 2 of 10

In an effort to conquer and banish those dreaded RDLC Brain Cramp (a.k.a. RBC) pains in my head from working with Microsoft Dynamics NAV 2013 RDLC reports, I have first decided not to beat my head against the wall when I can’t resolve the report issue. That has helped.

Secondly, I have found solutions to some of the more common issues with RDLC reports, and I’d like to share those with my fellow sufferers. So, let’s press on to part 2 of this 10 part series.

In case you missed it, Part 1 of the RDLC Brain Cramp series discussed inconsistencies in line spacing.

RBC 2: Every Other Page Is Blank

One of the first things a developer should do when testing an RDLC report is to press the Print Layout button in preview mode. Why? Because if you haven’t seen your report in Print Layout view, you haven’t seen what it will look like when printed. Report Preview does not render reports in the same way as they are rendered when they are printed, due to such things as page size.

Here’s a perfect example of a time when Print Layout proved a problem. Notice the report below, which is shown in PRINT PREVIEW mode on the left, and PRINT LAYOUT mode on the right.

Comparing the results of PRINT PREVIEW (on the left) with PRINT LAYOUT (on the right)

Figure 1 – Comparing the results of PRINT PREVIEW (on the left) with PRINT LAYOUT (on the right)

In PRINT PREVIEW, this is a two page report, and everything fits nicely on the page because the page size and margins have not been employed.

But once I click PRINT LAYOUT, notice that on the right my report has suddenly grown to SIX pages, and that every other page is empty – except for those nice little headings that say that I created this messL. Guilty as charged!

The every-other-page-blank issue is one that I hear about often. I think every Dynamics NAV developer has to encounter this at least once in order to learn about Report Properties.

Report Properties can only be used when you have clicked within the Report Layout itself. If you have your cursor focus outside of the layout (such as in the text box properties window) the option at the top of Visual Studio for REPORT is not seen. Click within your report, and you’ll see the tab for REPORT is visible. Under REPORT, you have some fantastic options:

Options available under the Report tab

Figure 2 – Options available under the Report tab

First, click to display the RULER. This will allow you to have a visual of the size of your report across your Visual Studio Report Designer page. The ruler will focus the beginning of the ruler at the leftmost of the page, NOT at the beginning of the page after the margin is employed (see below in red).

To see the size of your margins, choose REPORT – REPORT PROPERTIES. From here, you can change your report units of measure from inches to centimeters, set the paper size, set the report to Landscape if it’s too wide for Portrait layout, and even determine the size of your margins.

User Report -> Report Properties to change units of measure, paper size, and margine” src=”https://archerpoint.com/wp-content/uploads/2021/06/blog-rdlc-pt02-03.jpg” style=”height: 377px; width: 601px;”></p><p><em>Figure 3 – Use Report->Report Properties to change units of measure, paper size, and margins</em></p><p>In the report example above, I had a margin issue. When the left margin was set to 0.49 inches, the entire report could not print on an 8.5” x 11” page. Even though my ruler stopped at around 8” wide, the margin was taking up the remainder of the page. Adjusting the left margin to only .25 inches allowed the report to print one page wide.</p><p>When in Print Layout mode, as seen in the first image, the report was not printing blank pages one after another, but a blank page to the “side” of the other due to width problems.</p><p><strong>Hint 1:</strong> Never use the full width of the page. Always stop around 8.49 or less. (This hint, and many other for RDLC report design, was given to me by Claus Lundstrøm, one of the NAV community’s greatest resources for RDLC reporting.)</p><p><strong>Hint 2:</strong> Who needs a right margin? Leave it empty and if the report goes to close to the right edge of the page, decrease the left margin.</p><p><strong>Hint 3:</strong> Sometimes you’ll just have too much data to print on a page, even if you choose legal paper in landscape mode. If that’s the case, before modifying the report to fit a paper size, ask the user if they would prefer to have the report print to Excel. You don’t’ have to insert Excel .NET calls, or use the Excel buffer table for output. Just have them use the PRINT – PRINT TO EXCEL option when printing the report. By keeping the RDLC report layout, preview is still possible for any user that just wants to take a peek at the report without printing it.</p><h2>Coming Up</h2><p>This series is aimed at curing RBC’s completely! Next week we will look at <a href=ways to make a slow report run faster.

ArcherPoint is delighted to offer tips to developers throughout the NAV community, but code samples are not warranted, as all installations are different. It is advised that the developer verify that the solutions work for his or her installation of Dynamics NAV before implementing the code.

For more information on topics related to Microsoft Dynamics NAV development, read the ArcherPoint Developer Blog, written specifically for Dynamics NAV developers, or contact ArcherPoint directly.

Trending Posts

Stay Informed

Choose Your Preferences
First Name
*required
Last Name
*required
Email
*required
Subscription Options
Your Privacy is Guaranteed