You can use the Import Tag to add subdocuments to your finished report. If there are different headers and footers in your Master(Parent) template than in your child templates, you'll need to make some adjustments in AutoTag's setting (in the Tag Editor for every Import Tag) and you'll need to make some use of MS Office's native formatting options.
As an Add-In for MS Office, AutoTag works with many of Office’s native functions. The Import Tag can get tricky when you’re importing another Word document with its own styles and formatting. We have an article that might be a pre-requisite for some readers on how to apply the styles and formatting from either the parent document or the child document. Headers and Footers require a few more steps that we'll explain below.
There are two basic parts to this tutorial -- making changes in AutoTag and making changes in Word's native features.
Download the samples to play along!
- The same instructions will work for subreports that need to have no headers and footers when imported.
- You’ll note that there are page numbers shown. When you output, these will update and show the true page number for the whole document, counting the pages inserted by the Import Tag even if you didn’t insert page numbers into your child documents.
- Even though there is no data source needed in this example, you will still need to connect to a data source in order for the template to Output correctly.
Step 1: Updating AutoTag features in the Tag Editor
First we’ll make the changes we need to make in AutoTag.
In your template, insert an Import Tag. In the Tag Editor for that Tag, you’ll need to do a few things:
- In the Query Tab (or Select Statement Bar for previous versions) paste or type the file location of the document you want to import.
- In the Properties Tab, make three updates
- Under Tag, set the type to TEMPLATE. You'll need to do this before you are able to access some of the other properties.
- Under Documents, set break to before-page, and set use-child-styles to true
Step 2: Updating Native MS Features in your template
Now we’ll change some MS Office settings in your template. Remember this is the parent template (the one you’re going to Output, not the one you’re going to import).
Insert a Continuous Section Break before the first import tag, and after each tag. But after the last tag, insert a Section Break (NextPage).
- To add the section breaks, place your cursor right after the tag, then in the MS Ribbon, go to Layout >Breaks > Section Breaks > (Continuous or Next Page). Word will insert new pages and your tags will be on separate pages.
- Make sure that you’re selecting a Section Break option rather than just inserting a plain page break because Office uses Sections to define styles and formatting. You can turn on the options to see the formatting by clicking the paragraph options.
- Next you’ll need to Un-Link the Header and Footer sections following your two Import Tags.
- In each Header that is after your Import Tags, double click to access the header, then make sure that your cursor is in the header you need to unlink. The Design tab should be open, so click on Link to Previous (there’s no un-link button). When you do this, the Same as Previous flag will no longer show, because it’s no longer linked!
- Don’t forget to do the same for your footers! This is very important.
Step 3: Output your report
When you Output, you’ll see this if you're using our Sample templates. Subdoc A has green headers and footers while Subdoc B has yellow headers and footers.
Recap and Explanations
For you to be able to use this info as a creative spark for your own templates, you may need to understand the powers at work.
- By inserting section breaks, MS Word understands that you want it to stop using the settings it is using after that section break.
- By setting the parameters in the Tag Editor, you are telling AutoTag to not use the formatting that is already set up, and to instead use the child-styles that are in the Child Document.
- The break-before parameter in the Tag Editor tells AutoTag how to treat the subdocument when retrieving it and creating the final report. You can see that the font in Subdoc A is Algerian and in Subdoc B is Bauhaus. Those styles from the child document were used in the final report, but you needed to set a break before the next tag so that the headers and footers were correct. Without this step, the text could have ended up on the same page with mixed headers and footers.
- The MS Office section breaks after each Import Tag tell Office to stop using the current settings (in some cases these are the imported document's settings) and start over fresh.
- If you are making your template as you go and didn't have any pages after an Import Tag, and you already un-Linked the headers and footers, you may need to re-do your headers and footers in the next new section if the areas are blank.
- You still have to unlink the header and footers for every new section because they are set up separately to run on their own, regardless of the styles or formatting set in the main body of the document.