Solved

RDLC PDF Paging Issues

Posted on 2011-02-14
8
5,348 Views
Last Modified: 2016-09-12
Experts,

I have an RDLC report that I am using to generate PDF letters from a database.  Each letter (each record in the data source) should be on its own page, but may span multiple pages if necessary.  Basically, I have three fields that I use to generate each letter: AddressBlock, LetterDate, and BodyText.  The PDF file is generated from a windows app using the Microsoft.Reporting.WinForms.ReportViewer class.

I have used the below RDLC layout to generate the letters.  I just have a static header and footer, and one list in the body that contains three bound text boxes.

 Report Design
Everything has worked fine until I discovered that if the BodyText text box gets to be just the right size it will go off on to its own page, leaving the AddressBlock and LetterDate text boxes on the first page.  This does not happen if the contents are smaller (the letter is generated as just a single page), or if the contents are larger (the letter begins on the first page and spans across multiple pages).  In this perfect storm scenario, the contents of the BodyText text box are just long enough to warrant spanning to another page, but instead of the text box beginning on the first page and slightly spanning onto the second, the whole text box moves to the second page, and only the AddressBlock text box and the LetterDate text box are on the first page, with a bunch of white space below.


It is supposed to look like this (if the body can fit on one page):  Example 1-Page Letter

Or this (if the body is longer than what can fit on one page):  Example 2-Page Letter


but instead looks like this (incorrect):  Incorrect 2-Page Letter

I hope this is just something stupid, as I do not have a whole lot of reporting experience.  It has been driving me nuts for days...

Thanks,
Grant
0
Comment
Question by:gtporter
  • 4
  • 3
8 Comments
 
LVL 18

Accepted Solution

by:
chrismc earned 500 total points
ID: 34894748
Assuming this is SSRS 2005, then this is a particular weakness of it!

You have one cell that can get very large. SSRS will do everything to try and keep that object together on a page.

There are some "Keep Together" properties on various objects in SSRS. You could experiment with that but I've found it a bit hit and miss.

You are probably better off trying to break that "Body Text" down into smaller pieces in your data query then displaying it inside a nested list box.
0
 

Author Comment

by:gtporter
ID: 34896913
Thanks for your response.  As this is a client-side RDL file (not SSRS-hosted), and I am using the WinForms ReportViewer class, I can use whatever version I choose, as far as I know.  This was developed using VS2008, but I do have VS2010 and ReportBuilder 3.0 at my disposal if newer versions would not have this issue.  Splitting the body up did come to mind, but that would mean changing a bunch of code and including logic on where to split cleanly, etc.  I would rather fix this at the report definition level.

Thanks,
Grant
0
 
LVL 18

Expert Comment

by:chrismc
ID: 34898275
Hi Grant
The later versions are supposed to perform a lot better. But I haven't used them in earnest so can't add any useful comment on that.
I understand your dilemma on splitting the data but if you have to go down that route I'd suggest splitting on paragraph breaks.

Cheers
Chris
0
 

Author Comment

by:gtporter
ID: 34898800
I just tried VS2010.  Same story...  The version of the Microsoft.ReportViewer.WinForms DLL was 10.0.0.0 (runtime v2.0.50727).  Is this the latest version available?  I'm trying to avoid breaking up the string at all costs, but it's sounding more and more like that will be the only option.  I hate band-aids...

Thanks,
Grant
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 18

Expert Comment

by:chrismc
ID: 34898967
I know what you mean but on the flip side SSRS is a data reporting tool and not designed to be a word processor which is kind of what you are trying to do.
Not a criticism but if you look at it from that point of view it's more understandable.

I have reports that generate contract letters and I had to do the breakdown to make it format properly so I do feel your pain.

Cheers
Chris
0
 

Author Comment

by:gtporter
ID: 34899241
Oh, I hear you...  I was originally going to go with some sort of MS Word mail merge, but I determined that using a report would be more automated and easier on the end-users (we wouldn't have to teach them how to do a data-bound mail merge in Word).  I think I'll close this, as it seems like an easy solution was a pipe dream.  Thanks for your help.
0
 

Author Closing Comment

by:gtporter
ID: 34899267
While not the solution I was looking for, it did solve the problem.
0
 

Expert Comment

by:urvi chauhan
ID: 41793947
i have create page but when i convert report to pdf some text are missing in pdf
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Hi, I have heard from my friends that it’s not possible to create Label Printing report using SSRS. I am amazed after hearing this words not possible in SSRS. I googled lot and found that it is possible to some of people know about the Report Bui…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now