开发者

Can I add page numbers to a dynamically generated document using mime type application/msword?

How can I add page numbers to a dynamically gene开发者_如何学Pythonrated document using mime type application/msword?


Yes, you can add page numbers in dynamic generated documents. to get the codes open an new document enable page number in header/footer, save it as single page webpage(*.htm) open the resulting file in any text editors (ex notepad) Analyse the code and take the code that displaying the page number. here i tried to display page numbers as Page 1 of 15 like that . and here is the code i got it from *.htm file Note :you may need to copy associated styles also.

<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>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜