我可以使用mime type application / msword将页码添加到动态生成的文档中吗?

时间:2011-05-04 19:05:31

标签: java jsp ms-word mime page-numbering

如何使用mime type application / msword?

将页码添加到动态生成的文档中

1 个答案:

答案 0 :(得分:2)

是的,您可以在动态生成的文档中添加页码。获取代码在页眉/页脚中打开一个新文档启用页码,将其保存为单页网页(* .htm)在任何文本编辑器中打开生成的文件(ex记事本)  分析代码并获取显示页码的代码。在这里,我试图将页码显示为第1页,共15页。这是我从* .htm文件中获取的代码 注意:您可能还需要复制关联的样式。

<style>
 @page Section1
{
    size:11.0in 8.5in;
    mso-footer: url("http://images/footer.htm")f1; 
    mso-header: url("http://images/header.htm")h1;      
    mso-page-orientation:landscape;
    margin:0.3in 0.5in 0.4in 0.5in;
    mso-header-margin:.2in;
    mso-footer-margin:.2in;
    mso-paper-source:0;
    font-family:Gill Sans MT, Times New Roman, Trebuchet MS;
}
div.Section1
{ page:Section1;}
@page Section2
{
    size:11.0in 8.5in; 
    mso-footer: url("http://images/footer.htm")f1; 
    mso-header: url("http://images/header2.htm")h2;         
    mso-page-orientation:landscape;
    margin:0.3in 0.5in 0.4in 0.5in;
    mso-header-margin:.2in;
    mso-footer-margin:.2in;
    mso-paper-source:0;
    font-family:Gill Sans MT, Times New Roman, Trebuchet MS;
}
   </style> 
  ------------- 

  ------=_NextPart_000_0019_01CA5EDF.DC424910
   Content-Type: text/html;
   charset="iso-8859-1"
   Content-Transfer-Encoding: quoted-printable
   Content-Location: http://images/footer.htm

    <!--[if supportFields]>
   <div style=3D'mso-element:footer;' id=3D'f1'>
  <p class=3D'MsoFooter' style=3D'border:none;mso-border-bottom-alt:solid windowtext    .75pt;padding:0in;mso-padding-alt:0in 0in 1.0pt 0in'>
   <table border=3D"0" width=3D"100%" cellpadding=3D"0" cellspacing=3D"0">
                    <tr>

                        <td width=3D"25%" align=3D"right"style=3D"font-family:Gill Sans MT, Times New Roman, Trebuchet MS;font-size:16pt;color:#6cbc48;font-weight:bold;padding:7px 30px 0px 0px;" valign=3D"middle">
                           Page <span style=3D'**mso-field-code: PAGE**' ></span> of <span style=3D'**mso-field-code:NUMPAGES** '></span>&nbsp;
                        </td>

                </tr>
            </table>