【问题标题】:How to make the footer appear only from the second page onwards如何使页脚仅从第二页开始出现
【发布时间】:2021-11-16 14:46:11
【问题描述】:

我正在生成一个带有 html 的 .doc,我希望页脚只从第二页开始出现,有人知道该怎么做吗?我在这里看到了一些关于这个问题的答案,但我仍然不明白它在代码中的外观。

    <head>
        <style type="text/css" media="print">
              @page Section1 {
                  size:8.3in 11.7in;
                  mso-footer:f1;
                  mso-header:h1;
                  margin:0.0in 0.6in 0.0in 0.6in;
                  mso-header-margin:0.0in;
                  mso-footer-margin:0.0in;
              }
            
              div.Section1{ 
                page:Section1;
              }
              
              p.MsoFooter, li.MsoFooter, div.MsoFooter { 
              
                  mso-pagination:widow-orphan;
              }

<body>
        <!-- Content -->
        <div class="Section1">
            <!-- Cover Page 1  -->
            <div class="coverP">
            Cover page text goes here
            </div>

            <br clear="all" style="page-break-before:always" />

            <!-- Page 2 Starts -->
           <div>
           Page 2 goes here with footer (pg#2 and logo)
           </div>

           <br clear="all" style="page-break-before:always" />
           <!-- Page 3 Starts -->
        <div>
           page 3 go here with footer (pg#2 and logo)
         </div>  
<!---------- HEADER AND FOOTER SECTIONS --------------->
      
      <br clear="all" style="page-break-before:always" />
      <div style="mso-element:header" id="h1">
      <table>...</table> 
      </div> 

   <div style="mso-element:footer" id="f1" >
   <table>...</table>  
</div>
</body>
</html>```

told to configure ```mso-title-page: yes; ``` but where? And they also said to replace ```mso-``` with ``` mso-first-``` but again where and how? if anyone knows how to give me a light, I would appreciate it, or even send me the link to the documentation...

【问题讨论】:

  • 这里是否暗示“第 2 页”将始终从屏幕开始?

标签: html css ms-word word doc


【解决方案1】:

我明白了。我正在使用 visualforce 页面进行开发,但代码可以适应 HTML 等。设置 mso-title-page:yes;猫的飞跃是在@page 2 页脚中为第一页定义一个页脚,为其他页面定义另一个页脚,页眉也是如此,然后只需创建 ID 引用页脚/页眉的元素(页脚和页眉)第一页或其他页面,在我的情况下,因为我希望第一页有页眉而不是页脚,所以我没有为第一页创建页脚。它在代码中变得更加清晰。

<head>
        <style type="text/css" media="print">
              @page Section1 {
                  size:8.3in 11.7in;
                  mso-title-page:yes;<!--Aqui dizemos que esse documento vai possuir uma página título--->
                  mso-footer:f1;<!--Definimos o ID para o footer de todas as páginas, execeto a primeira-->
                  mso-header:h1;<!--Definimos o ID para o header de todas as páginas, execeto a primeira-->
                  mso-first-header: fh1;<!--Definimos o ID para o header da primeira página-->
                  mso-first-footer: ff1;<!--Definimos o ID para o footer da primeira página-->
                  margin:0.0in 0.6in 0.0in 0.6in;
                  mso-header-margin:0.0in;
                  mso-footer-margin:0.0in;
              }
            
              div.Section1{ 
                page:Section1;
              }

.
.
.
Códigos
.
.
.
   <!---------- HEADER AND FOOTER SECTIONS --------------->
      
    <br clear="all" style="page-break-before:always" />
      <div style="mso-element:header" id="h1">
      <!--  Código para a construção do header padrão -->
      </div>

   <br clear="all" style="page-break-before:always" />
      <div style="mso-element:footer" id="f1">
      <!--  Código para a construção do footer padrão -->
      </div>

   <br clear="all" style="page-break-before:always" />
      <div style="mso-element:header" id="fh1">
      <!--  Código para a construção do header exclusivo para a 1° página -->
      </div>


<!--Como eu não queria footer na primeira página, foi só não construir um footer que apontasse para o: style="mso-element:footer" id="ff1" -->

有用的链接 https://www.py4u.net/discuss/987057 http://techsynapse.blogspot.com/2007/03/generating-word-document-dynamically.html http://www.pbdr.com/ostips/wordfoot.htm

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-28
    • 1970-01-01
    • 2013-03-17
    • 2016-03-29
    • 1970-01-01
    相关资源
    最近更新 更多