Border Lines in Word Templates for Apex Office Print Reports

Border lines! Feels like I’m going to lose my mind! (Madonna, anyone?) 

A challenge that I’ve been asked about and I’ve experienced myself using AOP to generate reports is: How do I make the borders behave?  

Although my AOP “style” is to use a Word template to a PDF output, I still like to utilize tables in my Word AOP report template to lay out and format my reports. It’s a matter of preference I tend to do this the same way every time, but the pointers below may also be used when laying out an Excel template, for example. 

Often in formatting a nice pretty report, we like to use a mixture of border lines and no border lines. We want to highlight key information, but at the same time, not make our report look too “busy”. 

Sometimes, MS Word seems to make design decisions on it’s own, that you would rather not have on your report output, such as repeating border lines throughout the report. Thanks, Word, but no thanks! 

I’ve picked up a few handy tricks for ensuring those annoying border lines appear where you want, and not appear where you don’t want them to appear. 

Here are a couple actual scenarios re: border lines you may or may not have run into already: 

Scenario 1 

I need some assistance in removing some of the border lines. 

When I remove some it removes all the borders when I print. 

The reason this happens is that the formatting in the table “thinks” that the bottom border for one row is also a top border for the next row.  

What I Wanted  What the template looks like  What shows on the report 
Header Row  Header Row  Header Row 
Detail Row 1  Detail Row 1  Detail Row 1 
Detail Row 2  Detail Row 2  Detail Row 2 

This becomes extremely frustrating, but there’s a simple answer! 

If there is a separation line that’s needed in the template, but not necessary between every detail section line, the best way to do this is using a “buffer” line (empty table row) that is a very narrow row height (to ensure that it’s inconspicuous on final report) to separate the line that needs a border with the line that doesn’t. So, between the close tag of the first row, and the open tag of the row that requires different formatting, that is where the “buffer line” goes. 

Scenario 2 

How do I force spacing between lines? 

Add a “buffer” row in the table  in the template between the rows that require spacing and select/highlight only that line. Right click and go to Table Properties. Go to the Row tab and set the row height to the size desired for spacing. 

Run the report and you can see that an empty row with the row height specified now is between the two rows you wanted to space apart. 

About The Author

Scroll to Top