15 June 2009

Weekly Dynamic: Vertical Line in SSRS

We ran into a client requirement that an invoice have a vertical line separating the invoice details from the extended amount column in an SSRS 2005 based invoice for Project Accounting in Dynamics GP 10. The line had to go from the invoice header to the invoice footer that contained the total. It also had to cross page breaks with no spacing breaks at the header or the footer. Sounds pretty easy right? Actually it was a lot harder than you think and despite some really bizarre Google responses, we managed to find the answer ourselves.

The core problem was that the line would stop where the data stopped, usually short of the footer.

The answer was to create a rectangle (we probably could have used a line but it's easier to keep a rectangle straight) with only the left border visible. We drew the rectangle from the top of the invoice header to the footer ensuring that the body was long enough that the page area was completely accounted for with all of the report elements. This works until you have more than one page. To solve this, we opened the parameters of the rectangle and checked the "Repeat report item with data region on every page" and selected the only data item in the body, table 1. We then also checked the box to insert page breaks after the rectangle. That did it. The rectangle went to the bottom of every page every time.


Just to give you an idea, some of the respectable Google solutions (meaning they had been marked as accepted or approved in various forums) included using code to count the rows being returned and then using more code to properly end the line based on the row count, packaging the entire body inside of a list box and using it's boundaries to force a full page and using multiple tables in the body to move the total out of the footer to replicate a footer in the body. So you can see, it wasn't as easy to figure out as it sounds.

Some of our other rejected solutions included pre-printed forms, a sharpie and a ruler and using black paper so no one would know that there wasn't a line. I'm glad we found a better solution!