August 7, 2001 - Combining the Master and Content Pages | WebReference

August 7, 2001 - Combining the Master and Content Pages

Yehuda Shiran August 7, 2001
Combining the Master and Content Pages
Tips: August 2001

Yehuda Shiran, Ph.D.
Doc JavaScript

When working with IE print templates, for each formatted page, you need to have a master page (DeviceRect) which includes a content page (LayoutRect). The first printed page is different from the other pages because you need to include the CONTENTSRC attribute which specifies the content source. Here is the DeviceRect element for the first page:

<IE:DEVICERECT ID="page1" CLASS="masterstyle" MEDIA="print">
	<IE:LAYOUTRECT ID="layoutrect1" CONTENTSRC="2.html" 
            CLASS="contentstyle" NEXTRECT="layoutrect2"/>
</IE:DEVICERECT> 
And here is the DeviceRect element of the second page:

<IE:DEVICERECT ID="page2" CLASS="masterstyle" MEDIA="print">
	<IE:LAYOUTRECT ID="layoutrect2" CLASS="contentstyle"/>
</IE:DEVICERECT>
Let's format yesterday's tip. First, look at the outcome. Then, look at the code that does it:

<HTML XMLNS:IE>
<HEAD>
<?IMPORT NAMESPACE="IE" IMPLEMENTATION="#default">
<STYLE TYPE="text/css">
.contentstyle
{
  width:5.5in;
  height:8in;
  margin:1in;
  background:white;   
  border:1 dashed gray;
}
.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:LAYOUTRECT ID="layoutrect1" CONTENTSRC="010806.html" 
            CLASS="contentstyle" NEXTRECT="layoutrect2"/>
</IE:DEVICERECT>
<IE:DEVICERECT ID="page2" CLASS="masterstyle" MEDIA="print">
	<IE:LAYOUTRECT ID="layoutrect2" CLASS="contentstyle"/>
</IE:DEVICERECT>
</BODY>
</HTML>
For more information on IE print templates, go to Column 89, Print Templates, Part I.