Dynamically generated Word doc has double headers and footers
Hi,
I'm able to use CFcontent and CFheader tags etc. to generate a Word doc with dynamic data on the fly and such Word doc has several pages. An issue is the last page has double headers and footers. The following is the process:
1) <cfsavecontent
variable = "WDcontent">
2) Use Microsoft XML and Word style guide
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<style>
- p.MsoHeader, li.MsoHeader, div.MsoHeader
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:center 3.0in right 6.0in;}
p.MsoFooter, li.MsoFooter, div.MsoFooter
{margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
tab-stops:center 3.0in right 6.0in;
font-size:10.0pt;}
@4025150 Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in ;
mso-header: h1;
mso-footer: f1;
mso-header-margin:.5in;
mso-footer-margin:.5in; mso-paper-source:0;}
div.Section1
{page:Section1;}
// header & footer area
table#hrdftrtbl
{
margin:0in 0in 0in 9in;
}
</style>
3) continue with HTML body output
toward the end and before the top level DIV ends,
add the header and footer reference,
<table id='hrdftrtbl' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td>
<div style='mso-element: header' id="h1">
<p style='text-align: center'>
<img src="#baseURL#/header2.png" width="90%" height="75">
</p>
</div>
</td>
<td>
<div style='mso-element: footer' id="f1">
<p align="right">
<span style=mso-tab-count:2'>
<img src="#baseURL#/footer2.png" width="90%" height="15">
</span>
</p>
</div>
</td>
</tr>
</table>
Then, after HTML closing
</cfsavecontent>
4) direct output to Word
<!--- WORD version --->
<cfheader name="content-disposition" value="filename=myNew.doc">
<cfcontent type="application/msword">
<cfprocessingdirective suppressWhiteSpace = "true">
<cfoutput>#WDcontent#</cfoutput>
</cfprocessingdirective>
Thoughts?
tia.
