August 3, 2001 - Specifying the Master Page's Attributes | WebReference

August 3, 2001 - Specifying the Master Page's Attributes

Yehuda Shiran August 3, 2001
Specifying the Master Page's Attributes
Tips: August 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

When you develop a print template, you start with a master page that formats the background of all pages. You need to specify a master page for each page, but you can specify the same master page for all pages. Here is the HTML code that displays two master pages:

<HTML XMLNS:IE>
<HEAD>
<?IMPORT NAMESPACE="IE" IMPLEMENTATION="#default">
<STYLE TYPE="text/css">
.masterstyle
{ 
    width:8.5in;
    height:11in;
    background:#FFFF99;   
	border-left:1 solid black;
	border-top:1 solid black;
	border-right:4 solid black;
	border-bottom:4 solid black;
    margin:10px;
}
</STYLE>
</HEAD>
<BODY>
<IE:DEVICERECT ID="page1" CLASS="masterstyle" MEDIA="print">
</IE:DEVICERECT>
<IE:DEVICERECT ID="page2" CLASS="masterstyle" MEDIA="print">
</IE:DEVICERECT>
</BODY>
</HTML>
We have included two DeviceRect elements. You need to include one DeviceRect element per page. If you have 100 pages, you need to include 100 DeviceRect tags. Don't panic. We'll show you in an upcoming tip how to create them automatically, on the fly. Notice the few parameters we specified for these DeviceRect elements. The ID attributes should be unique per page. The CLASS attribute specifies the STYLE definition, masterstyle, to be used for the page. The MEDIA attribute tells the browser that the final target of this template is for printing.

See what the master page looks like. For more information on print templates, go to Column 89, Print Templates, Part I.