Я создаю Формат слова .doc использующий следующего кода, затем cfheader и cfcontent для обслуживания. Все хорошо, но я должен смочь поместить динамическую информацию в заголовок (или нижний колонтитул), или автоматический pagenumbering был бы почти лучшей опцией.
Как я должен изменить код?
<cfsavecontent variable="myDocument">
<html xmlns:w="urn:schemas-microsoft-com:office:word">
<!--- Head tag instructs Word to start up a certain way, specifically in
print view. --->
<head>
<xml>
<w:WordDocument>
<w:View>Print</w:View>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
</w:Compatibility>
<w:DoNotOptimizeForBrowser/>
</w:WordDocument>
</xml>
</head>
<body>
Regular HTML document goes here
<!--- Create a page break microsoft style (took hours to find this)
--->
<br clear="all"
style="page-break-before:always;mso-break-type:page-break" />
Next page goes here
</body>
</html>
</cfsavecontent>
Обратите внимание на это: Верхний и нижний колонтитулы Я успешно создал собственный верхний и нижний колонтитулы только с одним файлом html, используя эту статью. (Word 2003)
Надеюсь, это поможет!
Нелегко добавить номер страницы с помощью WordprocessingML
http://openxmldeveloper.org/archive/2006/08/03/443.aspx
Если вы можете использовать PDF вместо DOC, вот решение для нумерации страниц.
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7c21.html
См. Пример 2:
<cfdocument format="pdf">
<cfdocumentitem type="header" evalatprint="true">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td align="right"><cfoutput>#cfdocument.currentsectionpagenumber# of
#cfdocument.totalsectionpagecount#</cfoutput></td></tr>
</table>
</cfdocumentitem>
<cfdocumentitem type="footer" evalatprint="true">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td align="center"><cfoutput>#cfdocument.currentpagenumber# of
#cfdocument.totalpagecount#</cfoutput></td></tr>
</table>
</cfdocumentitem>
...
</cfdocument>