在Coldfusion中创建Word文档-如何进行页面编号?

在Coldfusion中创建Word文档-如何进行页面编号?,coldfusion,ms-word,wordml,wordprocessingml,Coldfusion,Ms Word,Wordml,Wordprocessingml,我正在使用以下代码创建一个Word格式的.doc,然后使用cfheader和cfcontent提供服务。一切都很好,但我需要能够把动态信息的页眉(或页脚),否则自动页码将是第二个最好的选择 我应该如何修改代码 <cfsavecontent variable="myDocument"> <html xmlns:w="urn:schemas-microsoft-com:office:word"> <!--- Head tag instructs Word to star

我正在使用以下代码创建一个Word格式的.doc,然后使用cfheader和cfcontent提供服务。一切都很好,但我需要能够把动态信息的页眉(或页脚),否则自动页码将是第二个最好的选择

我应该如何修改代码

<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文档位于此处

下一页在这里
使用WordprocessingML添加页码似乎并不容易

如果您可以提供PDF而不是DOC,这里有一个页面编号的解决方案

参见示例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>

#cfdocument.currentsectionpagenumber#共页
#cfdocument.totalsectionpagecount#
#cfdocument.currentpagenumber#共页
#cfdocument.totalpagecount#
...    

请看一下: 我已经成功地创建了自定义页眉和页脚,只有一个html文件使用本文。(Word 2003)


希望这有帮助

版本9.01,必须添加允许评论有用链接的最小文本。谢谢Henry,客户端需要.doc或.rtf。使用您的方法,是否有办法省略页码的第一页并从第二页开始?