I have seen various postings on being able to use BIP with Avery label templates. Im not limited to Avery here, there are other templates out there too. I have recently been working with John and colleagues over in Oklahoma City who were desperate; desperate might be too strong a word but they needed, at least, to get BIP generating their address labels.
Problem was, existing solutions, my efforts so far have fallen into this category, would work for a page or even a couple but after that things started to slip down the page and you started to get addresses spanning labels and it degenerated into a big mess very quickly.
If you take a look at Avery's templates
You'll notice that they put in the nice Word shapes to show you where the label is on the paper. Looks great and your mind, as a template developer falls immediately to using a shape file and manipulating it for a really groovy BIP template. Sadly, the shape manipulation support is not aware of margins and headers and footers. So it will keep repeating the label shape off the bottom of the page and on to the next. Its not an easy thing to address. I once spoke to Edward (RTF parser builder extraordinaire) about the shape support. They are not bound by the margins, etc so can be placed any where on the page leading to issues when you want repeat them down the page.
So the shape approach is out; I took a closer look at the Avery template.
There is actually a table behind the scenes keeping the shapes in their place. Worth a look. I went down the path of a previous post, using a single row and a for-each loop. I ran into another problem with keeping rows on the page and getting addresses to run across and then down. That was out then.
During this time I was writing the old school cross-tabbing post. That got me thinking about another solution.
Rather than trying to work with a row of a table; how about a single cell and some cross tabbing tricks. Looking closer at the table:
We have that nasty spacer column to deal with. All we need is the top left cell with the spacer column. A little bit of table manipulating and I had a single cell made up of the top left cell extended by the spacer column. Graphic shows the modified top left cell and the next below with the spacer column still present.
If I can repeat that cell across the page and then down I will get the spacing I need to get the document to print on the label paper.
Here's the template:
Not much to it really, just a couple of neat tricks with some help from template meister Hok-Min. Heres the data structure we were working with:
<STREET>1 Oracle Street</STREET>
<STREET>2 Oracle Street</STREET>
Here are the fields and their contents:
|FE||<?for-each:ADDRESS[position() mod 3=1]?>|
|FEC||<?for-each@column:. | following-sibling::ADDRESS[position()<3]?>|