Wednesday, December 19, 2007

A Different Header on Page 2?

So you got your subtemplate working in the header of your reports, but what if you want a different header on page 2? You're in luck because that can be accomplished fairly easily.
For this example I modified the .xml file to include a notes field and a report name field. You can download the file from http://www.mediafire.com/?9xzyfy3bivd




I also created a new header/footer subtemplate and an example3.rtf template. They are also available for download at : http://www.mediafire.com/?8vb1vmteoay and http://www.mediafire.com/?1dxwodzd7mz .

Let's first look at the new header/footer subtemplate:





In the subtemplate header I am now passing 2 parameters (P_DATE and REPORT_NAME). I added REPORT_NAME so that for our examples at least, the name of the report will be dynamic. Then, in the middle column I called the value passed to the subtemple for REPORT_NAME by using <?REPORT_NAME?>. Now onto the new example3.rtf template














The template has a few changes that we can see (as indicated by the arrows). First, the value of REPORT_NAME from the .xml file is being passed to the subtemplate in our header by using ;$REPORT_NAME;$REPORT_NAME. The second change is in the main table indicated by arrow 2. The only change here, was that I added a second row to display our new vendor notes tag from the example3.xml file. The last change shown in the image above is the addition of the template 'BodyHeader' that will be used on pages other than the first page.

Back to the main topic of this post.... MS Word functionality gives us the ability to have a different first page. If you enter the header section of the template (View -> Header and Footer) you will see this icon





This has a properties dialog box where you can set 'different first page'.










When you click 'OK' you will be back out to your header section of the template. Enter what you would like for the header and footer (in our case, it is the call to ex3_subtemplate.rtf). Once you set this up on the first page, go to the end of your template layout and insert a page break. On the new blank page 2, go back to the header and footer section and enter what you would like on page 2. If you downloaded the example3.rtf file, you may not see page 2 because if I left blank lines in the template the output was showing an extra page. But, if you hit enter until you get to page 2, you will see different code in the header section.





This is the call to the template that we have in our example3.rtf. It is not a subtemplate that is used universally, but a subtemplate used within example 3. Because you are not allowed to enter tags in the header and footer sections of the .rtf, a call to a subtemplate will accomplish this. And here is our final product....




























Happy BIPping!

2 comments:

Tim Dexter said...

Hey BIPgirl
Great article!
I like to see that you're building the BIPGurrrl brand ... nice logo and even official offices in Bipgirl Lane.
Next they'll be a clothing and accessory line and fame and fortune will be assured.
Tim

BIPgirl said...

Great Idea Tim! Next month you'll see links to coffee mugs and t-shirts! haha