Type: | Heading Tags |
---|---|
Attributes: | |
See: | a body div macrolist |
A macro is a way of including a specific piece of XML multiple times in the same document. There is no equivalent in HTML.
Currently this is only used in one place - when a new page is created. A macro is defined in a macrolist element in the head of the document. Each macro is effectively a div, and must have an id, which is used to reference it in the body of the document.
The exact properties of the div depend on the type of macro - header, footer or background-macro - but you can rely on them having a width and height specified.
The following example shows a macro being defined and then assigned to the background-macro attribute of the body. This is followed by the equivalent XML without macros (assuming the document is only one page).
Here's an example using the "background-macro" attribute.
<head> <macrolist> <macro id="watermark"> <div align="center" valign="middle" rotate="-45" font-size="48pt"> Confidential </div> </macro> </macrolist> </head> <body background-macro="watermark"> <p>The Document Body</p> </body>
When the above macro is processed, internally it's turned into the following structure.
<body> <div width="100%" height="100%" position="absolute"> <div align="center" valign="middle" rotate="-45" font-size="48pt"> Confidential </div> </div> <p>The Document Body</p> </body>
The footer and header macros are similar. Here's a simple footer example...
<head> <macrolist> <macro id="myfooter"> <div align="center" border-top="1" > Page &pagenumber; </div> </macro> </macrolist> </head> <body width="8.5in" height="11in" footer="myfooter" footer-height="1in"> <p>The Document Body</p> </body>
...and here's how the document looks internally after it's been processed. Note the change in dimensions
<body width="8.5in" height="10in"> <div width="100%" height="1in" position="absolute"> <div align="center" border-top="1"> Page <pagenumber/> </div> </div> <p>The Document Body</p> </body>